Skip to content

Commit

Permalink
Optimize percentile calculation by optimizing binary heap clone
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhei committed Dec 24, 2018
1 parent c0f9e33 commit 6b41671
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/binary_heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BinaryHeap.prototype = {
clone: function() {
var heap = new BinaryHeap(this.scoreFunction);
// A little hacky, but effective.
heap.content = JSON.parse(JSON.stringify(this.content));
heap.content = this.content.slice();
return heap;
},

Expand Down

0 comments on commit 6b41671

Please sign in to comment.