Closed wemeetagain closed 2 months ago
this is amazing ❤️ , would be great if you can add a Readme on how to setup environment, build and run tests @wemeetagain
@twoeths
You will need https://rustup.rs/ installed. Also very recommended to have rust extensions in vscode.
This branch currently only adds code so that side-by-side benchmarks can be run, with the napi-rs version running alongside the existing 0.2.x branch.
All new code is in the next/
directory. Run all napi-rs/rust commands from this directory. This will all be moved to the root when we're ready.
Bindings are done using https://napi.rs/. Feel free to review the docs there, or look at this branch as an example for how it can be used.
All bindings code lives in next/src/lib.rs
-- this is the file that should be more carefully reviewed.
To build the bindings, run yarn build
. This will both (re)compile the rust code and (re)generate js and ts bindings files (index.js and index.d.ts).
For rust-specific commands, you can use cargo
. Some useful commands: cargo fmt
to lint/format the code. cargo build
for a debug build. cargo add
to add additional rust dependencies. See the docs for more.
To run a benchmark, first build all the bindings (both napi-rs and 0.2.x), then run from the root: node -r ts-node/register benchmark/XXX.ts
Adding memory test results here for posterity
Napi SecretKey - 109 b / instance - 2803528 allocated by 26000 instances - 5767168 rss allocated
Napi PublicKey - 108 b / instance - 2032424 allocated by 19000 instances - 933888 rss allocated
Napi Signature - 108 b / instance - 2889680 allocated by 27000 instances - 5095424 rss allocated
this LGTM
@matthewkeil want a last review before I merge and release?
~not sure why CI just started failing :(~
Edit: node 22.5.0 broke
Roughly equivalent rewrite of the v0.2.x branch using napi-rs and the
blst
crateKey differences:
agregateWithRandomness
functionResults are promising. This is a comparison between 0.2.x branch and this branch (labeled
- next
)