Reuse internal locations array for speed.
This commit is contained in:
parent
fb9ec01fdb
commit
a74be9b5d8
@ -6,6 +6,7 @@
|
||||
function BloomFilter(m, k) {
|
||||
this.m = m;
|
||||
this.k = k;
|
||||
this._locations = [];
|
||||
var buckets = this.buckets = [],
|
||||
n = Math.ceil(m / k),
|
||||
i = -1;
|
||||
@ -16,7 +17,7 @@
|
||||
BloomFilter.prototype.locations = function(v) {
|
||||
var k = this.k,
|
||||
m = this.m,
|
||||
r = [],
|
||||
r = this._locations,
|
||||
a = fnv_1a(v),
|
||||
b = fnv_1a_b(a),
|
||||
i = -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user