Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds candid-wasm-bindgen library for npm #380

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

krpeacock
Copy link
Contributor

Overview
To facilitate any workflow where someone wants to dynamically generate IDL from declarations, this bundles functionality from Candid into utility methods for string -> file output using wasm-pack

Since IO is not available in a wasm browser context, I had to make changes so that File types were not required

Considerations
What impact will this change have on security, performance, users (e.g. breaking changes) or the team (e.g. maintenance costs)?

@github-actions
Copy link

github-actions bot commented Oct 3, 2022

Benchmark for d78e16e

Click to view benchmark
Test Base PR %
Blob/&str 263.7±143.29µs 263.3±125.64µs -0.15%
Blob/ByteBuf 163.9±44.30µs 164.2±44.13µs +0.18%
Blob/Bytes 121.9±41.41µs 110.3±40.63µs -9.52%
Blob/String 311.3±152.49µs 309.6±144.29µs -0.55%
Collections/vec (text, nat) 75.0±1.51ms 76.9±1.48ms +2.53%
Collections/vec int 33.2±0.12ms 33.4±0.10ms +0.60%
Collections/vec int64 22.5±0.46ms 26.9±0.33ms +19.56%
Collections/vec nat8 17.8±0.04ms 21.6±0.08ms +21.35%
option list/1024 2.4±0.01ms 2.4±0.00ms 0.00%
profiles/1024 4.2±0.11ms 4.2±0.06ms 0.00%
variant list/1024 2.3±0.01ms 2.3±0.02ms 0.00%

Copy link
Contributor

@chenyan-dfinity chenyan-dfinity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LG. Is it better to host this in agent-js repo? With the new ic-verify-bls-signature crate, we probably need a similar npm package there.

tools/candid-wasm-bindgen/Cargo.toml Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Oct 4, 2022

Benchmark for 4fbffc6

Click to view benchmark
Test Base PR %
Blob/&str 279.0±151.63µs 268.9±147.08µs -3.62%
Blob/ByteBuf 193.7±48.08µs 191.1±53.84µs -1.34%
Blob/Bytes 138.4±45.85µs 129.6±46.03µs -6.36%
Blob/String 345.7±154.93µs 331.2±153.49µs -4.19%
Collections/vec (text, nat) 87.8±3.08ms 79.5±3.35ms -9.45%
Collections/vec int 38.2±1.44ms 37.8±1.87ms -1.05%
Collections/vec int64 24.7±1.14ms 25.4±2.02ms +2.83%
Collections/vec nat8 21.0±0.69ms 20.0±0.56ms -4.76%
option list/1024 2.6±0.10ms 2.7±0.09ms +3.85%
profiles/1024 4.6±0.20ms 4.8±0.19ms +4.35%
variant list/1024 2.7±0.12ms 2.7±0.08ms 0.00%

@github-actions
Copy link

github-actions bot commented Oct 4, 2022

Benchmark for e3d7dfc

Click to view benchmark
Test Base PR %
Blob/&str 234.4±69.40µs 243.1±69.82µs +3.71%
Blob/ByteBuf 165.6±46.47µs 166.6±44.87µs +0.60%
Blob/Bytes 110.6±30.96µs 114.9±29.99µs +3.89%
Blob/String 237.8±68.33µs 262.9±79.47µs +10.56%
Collections/vec (text, nat) 74.6±1.12ms 74.0±1.54ms -0.80%
Collections/vec int 33.4±0.15ms 33.1±0.13ms -0.90%
Collections/vec int64 23.4±0.36ms 23.0±0.32ms -1.71%
Collections/vec nat8 17.2±0.07ms 17.2±0.03ms 0.00%
option list/1024 2.4±0.01ms 2.4±0.02ms 0.00%
profiles/1024 4.2±0.02ms 4.2±0.01ms 0.00%
variant list/1024 2.4±0.03ms 2.4±0.01ms 0.00%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants