Skip to content

Commit

Permalink
js: add benches
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Oct 30, 2024
1 parent 173d8b1 commit cfd2db9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bindings/nostr-sdk-js/benches/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "rust-nostr-benches",
"version": "1.0.0",
"description": "",
"private": true,
"dependencies": {
"@rust-nostr/nostr-sdk": "file:../"
}
}
14 changes: 14 additions & 0 deletions bindings/nostr-sdk-js/benches/rust-nostr.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {
loadWasmAsync,
loadWasmSync,
} from "@rust-nostr/nostr-sdk";

// @ts-ignore
Deno.bench("loadWasmSync", () => {
loadWasmSync();
});

// @ts-ignore
Deno.bench("loadWasmAsync", async () => {
await loadWasmAsync();
});
4 changes: 4 additions & 0 deletions bindings/nostr-sdk-js/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ init:
clean:
rm -rf ./pkg
rm -f rust-nostr-*.tgz
cd benches && rm -rf node_modules package-lock.json

publish:
npm publish --access public

pack: init clean
bash ./scripts/build.sh
npm pack

bench:
cd benches && npm install && deno bench

0 comments on commit cfd2db9

Please sign in to comment.