https://github.com/anon767/hashmapnode
faster hashmap for nodejs
https://github.com/anon767/hashmapnode
fast hashmap map native nodejs string
Last synced: 22 days ago
JSON representation
faster hashmap for nodejs
- Host: GitHub
- URL: https://github.com/anon767/hashmapnode
- Owner: anon767
- Created: 2018-07-27T08:18:58.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-21T19:25:10.000Z (over 6 years ago)
- Last Synced: 2025-03-30T11:33:21.649Z (about 2 months ago)
- Topics: fast, hashmap, map, native, nodejs, string
- Language: C++
- Size: 88.9 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Native Hashmap
Simple but fast Hashmap for NodeJS. Implemented in C++.## Install
```
npm i nativehashmap
```
## Sample Usage```javascript
var hashmap=require("nativehashmap");
hashmap.add("key", "value");
console.log(hashmap.get("key"));
```Its possible to store JSON objects like:
```javascript
addon.add("object", JSON.stringify({o:"test"}));
console.log(JSON.parse(addon.get("object")).o === "test");
```Also you can fetch values Async
```javascript
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: