megahash
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "megahash", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A super-fast C++ hash table with Node.js wrapper.", | ||
@@ -5,0 +5,0 @@ "author": "Joseph Huckaby <jhuckaby@gmail.com>", |
@@ -19,5 +19,5 @@ // Simple benchmarking script for MegaHash | ||
const MAX_KEYS = 8000000; | ||
const MAX_READS = 2000000; | ||
const METRICS_EVERY = 100000; | ||
const MAX_KEYS = 100000000; | ||
const MAX_READS = 4000000; | ||
const METRICS_EVERY = 1000000; | ||
@@ -24,0 +24,0 @@ print("\nMax Keys: " + Tools.commify(MAX_KEYS) + "\n"); |
23
test.js
@@ -217,4 +217,6 @@ // Unit tests for MegaHash | ||
hash.set("key2", "value2"); | ||
hash.remove("key1"); | ||
test.ok( !!hash.remove("key1"), "remove returned true for good key" ); | ||
test.ok( !hash.remove("key3"), "remove returned false for missing key" ); | ||
test.ok( !hash.has("key1"), "Key1 was removed" ); | ||
@@ -289,3 +291,3 @@ test.ok( hash.has("key2"), "Key2 is still there" ); | ||
var lastNumKeys = hash.stats().numKeys; | ||
for (var idx = 0; idx < 16; idx++) { | ||
for (var idx = 0; idx < 256; idx++) { | ||
hash.clear(idx); | ||
@@ -298,5 +300,5 @@ var numKeys = hash.stats().numKeys; | ||
var stats = hash.stats(); | ||
test.ok(stats.numKeys === 0, '0 keys in stats'); | ||
test.ok(stats.dataSize === 0, '0 bytes in data store'); | ||
test.ok(stats.numIndexes === 1, '1 index in stats'); | ||
test.ok(stats.numKeys === 0, '0 keys in stats: ' + stats.numKeys); | ||
test.ok(stats.dataSize === 0, '0 bytes in data store: ' + stats.dataSize); | ||
test.ok(stats.numIndexes === 1, '1 index in stats: ' + stats.numIndexes); | ||
@@ -429,2 +431,13 @@ test.done(); | ||
function testKeyIterationBad(test) { | ||
var hash = new MegaHash(); | ||
hash.set("key1", "value1"); | ||
hash.set("key2", "value2"); | ||
var key = hash.nextKey("key3"); | ||
test.ok( !key, "nextKey found nothing with missing key" ); | ||
test.done(); | ||
}, | ||
function testReindex(test) { | ||
@@ -431,0 +444,0 @@ // add enough keys so we trigger at least one reindex |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
65181
579