Reuse internal locations array for speed.

This commit is contained in:
Jason Davies 2011-12-06 23:51:41 +00:00
parent fb9ec01fdb
commit a74be9b5d8
1 changed files with 2 additions and 1 deletions

View File

@ -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;