From a74be9b5d8aea70d3cfcf42b9e9ea80f391d9e4c Mon Sep 17 00:00:00 2001 From: Jason Davies Date: Tue, 6 Dec 2011 23:51:41 +0000 Subject: [PATCH] Reuse internal locations array for speed. --- bloomfilter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bloomfilter.js b/bloomfilter.js index 9bac70b..332cb14 100644 --- a/bloomfilter.js +++ b/bloomfilter.js @@ -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;