4
GitHub - rustq/napi-nanoid: The NAPI nanoid written in Rust
source link: https://github.com/rustq/napi-nanoid
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
napi-nanoid
The NAPI nanoid written in Rust
一款基于 Rust 实现的 NAPI nanoid
Install
$ yarn add napi-nanoid
$ npm i napi-nanoid
Usage
const { nanoid } = require('napi-nanoid');
nanoid() // => AeogKAGjUMX6mqB4sMzWe
Performance
Running "napi-nanoid" suite...
napi-nanoid:
4 066 259 ops/s, ±0.49% | fastest
js-nanoid:
2 284 720 ops/s, ±0.68% | 43.81% slower
uuid:
662 363 ops/s, ±0.91% | slowest, 83.71% slower
Finished 3 cases!
Fastest: napi-nanoid
Slowest: uuid
Done in 17.41s.
Benchmark configuration: Linux x64 gnu, Intel(R) Xeon(R) CPU E5-2673 v4 @ 2.30GHz, Node.js 16.15.0
Support matrix
node12 | node14 | node16 | |
---|---|---|---|
Windows x64 | ✓ | ✓ | ✓ |
Windows x32 | ✓ | ✓ | ✓ |
Windows arm64 | ✓ | ✓ | ✓ |
macOS x64 | ✓ | ✓ | ✓ |
macOS arm64 | ✓ | ✓ | ✓ |
Linux x64 gnu | ✓ | ✓ | ✓ |
Linux x64 musl | ✓ | ✓ | ✓ |
Linux arm gnu | ✓ | ✓ | ✓ |
Linux arm64 gnu | ✓ | ✓ | ✓ |
Linux arm64 musl | ✓ | ✓ | ✓ |
Android arm64 | ✓ | ✓ | ✓ |
Android armv7 | ✓ | ✓ | ✓ |
FreeBSD x64 | ✓ | ✓ | ✓ |
Development
$ git clone https://github.com/rustq/napi-nanoid
$ cd napi-nanoid
$ yarn
$ yarn build
$ yarn test
$ yarn bench
License
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK