1.3.0 • Published 6 years ago

nativehashmap v1.3.0

Weekly downloads
11
License
MIT
Repository
github
Last release
6 years ago

Native Hashmap

Simple but fast Hashmap for NodeJS. Implemented in C++.

Install

npm i nativehashmap

Sample Usage

var hashmap=require("nativehashmap");
hashmap.add("key", "value");
console.log(hashmap.get("key"));

Its possible to store JSON objects like:

addon.add("object", JSON.stringify({o:"test"}));
console.log(JSON.parse(addon.get("object")).o === "test");

Also you can fetch values Async

addon.add("object", JSON.stringify({o:"test"}));
addon.getAsync("object",function(value){
   console.log(JSON.parse(value).o === "test"); 
});

Check out the Tests and Benchmarks for further examples

Metrics

Compared to npm package "hashmap" this implementation is about twice as fast in reading and writing. Even compared to default Javascript Array access "native hashmap" is a magnitude faster in synchronously reading and writing. Benchmark for yourself by executing

npm run benchmark

Latest benchmark results for writing and reading 5000k strings consecutively:

alt text

1.3.0

6 years ago

1.2.9

6 years ago

1.2.8

6 years ago

1.2.7

6 years ago

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago