tangledbytes / nodejs-snowflake

Generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)
https://www.npmjs.com/package/nodejs-snowflake
Apache License 2.0
176 stars 15 forks source link

Rewrite nodejs-snowflake in Rust #14

Closed tangledbytes closed 2 years ago

tangledbytes commented 2 years ago

Description

This PR rewrites entire nodejs-snowflake into Rust. Following are the reasons:

  1. Noticeable performance gains when using WASM instead N-API (now Node-API).
  2. N-API required to build binaries for each platform and NodeJS version, however owing to the design of WASM it is quite easy to compile just for the WASM VM. This allows easy installation of the extension without needing any build tools (likes of https://github.com/utkarsh-pro/nodejs-snowflake/issues/13).
  3. I ❤️ Rust.