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

Add Func::new constructor #662

Merged
merged 5 commits into from
Feb 10, 2023
Merged

Add Func::new constructor #662

merged 5 commits into from
Feb 10, 2023

Conversation

Robbepop
Copy link
Member

Closes #658.

cc @tomaka

This allows for dynamically typed Func creation. While generally inferior to Func::wrap from a safety and efficiency perspective this allows for certain use cases that are not possible to be covered by Func::wrap.
@paritytech-cicd-pr
Copy link

BENCHMARKS

NATIVEWASMTIME
BENCHMARKMASTERPRDIFFMASTERPRDIFFWASMTIME OVERHEAD
execute/
bare_call_0
1.47ms 1.46ms ⚪ -0.83% 1.17ms 1.17ms ⚪ 0.49% 🟢 -20%
execute/
bare_call_0/typed
1.06ms 1.05ms ⚪ -1.12% 765.26µs 768.24µs ⚪ 0.42% 🟢 -27%
execute/
bare_call_1
1.53ms 1.50ms ⚪ -1.30% 1.37ms 1.37ms ⚪ 0.20% 🟢 -9%
execute/
bare_call_16
2.35ms 2.34ms ⚪ -0.62% 4.28ms 4.26ms ⚪ -0.42% 🟡 82%
execute/
bare_call_16/typed
1.59ms 1.60ms ⚪ 0.87% 2.21ms 2.23ms ⚪ 0.76% 🟢 40%
execute/
bare_call_1/typed
1.17ms 1.16ms ⚪ -0.99% 1.21ms 1.18ms ⚪ -2.19% 🟢 1%
execute/
bare_call_4
1.67ms 1.64ms 🟢 -2.24% 1.85ms 1.85ms ⚪ 0.30% 🟢 13%
execute/
bare_call_4/typed
1.15ms 1.15ms ⚪ 0.00% 1.23ms 1.23ms ⚪ -0.19% 🟢 6%
execute/
br_table
1.18ms 1.18ms ⚪ -0.10% 1.40ms 1.43ms 🔴 2.18% 🟢 21%
execute/
count_until
682.77µs 651.47µs 🟢 -4.60% 2.13ms 2.13ms ⚪ 0.06% 🔴 227%
execute/
factorial_iterative
334.71µs 330.00µs 🟢 -1.45% 900.86µs 906.96µs ⚪ 0.71% 🔴 175%
execute/
factorial_recursive
665.95µs 644.30µs 🟢 -3.39% 1.35ms 1.35ms ⚪ 0.40% 🔴 110%
execute/
fib_iterative
1.35ms 1.52ms 🔴 11.94% 5.01ms 5.00ms ⚪ -0.03% 🔴 230%
execute/
fib_recursive
6.06ms 5.94ms 🟢 -2.08% 11.89ms 11.89ms ⚪ -0.03% 🟡 100%
execute/
global_bump
979.80µs 963.94µs 🟢 -1.65% 2.59ms 2.56ms 🟢 -1.28% 🔴 166%
execute/
global_const
736.76µs 743.46µs ⚪ 0.86% 2.43ms 2.40ms 🟢 -1.48% 🔴 223%
execute/
host_calls
27.43µs 27.73µs ⚪ 1.25% 42.25µs 40.91µs 🟢 -4.10% 🟢 48%
execute/
memory_fill
1.26ms 1.31ms 🔴 4.10% 4.03ms 4.03ms ⚪ -0.17% 🔴 208%
execute/
memory_sum
1.22ms 1.30ms 🔴 6.89% 4.01ms 4.01ms ⚪ 0.14% 🔴 208%
execute/
memory_vec_add
2.49ms 2.51ms ⚪ 0.73% 7.63ms 7.64ms ⚪ 0.08% 🔴 204%
execute/
recursive_is_even
1.14ms 1.14ms ⚪ 0.12% 2.36ms 2.22ms 🟢 -5.80% 🟡 95%
execute/
recursive_ok
150.87µs 150.56µs ⚪ -0.17% 345.89µs 313.08µs 🟢 -9.48% 🔴 108%
execute/
recursive_scan
188.29µs 179.55µs 🟢 -4.75% 427.93µs 394.38µs 🟢 -7.70% 🔴 120%
execute/
recursive_trap
15.26µs 16.07µs 🔴 4.60% 34.98µs 30.80µs 🟢 -11.86% 🟡 92%
execute/
regex_redux
536.44µs 537.13µs ⚪ 0.09% 1.39ms 1.39ms ⚪ -0.60% 🔴 158%
execute/
rev_complement
480.23µs 489.75µs 🔴 2.11% 1.40ms 1.39ms ⚪ -0.32% 🔴 185%
execute/
tiny_keccak
331.31µs 351.70µs 🔴 6.22% 1.14ms 1.15ms ⚪ 0.15% 🔴 226%
execute/
trunc_f2i
722.31µs 725.31µs ⚪ 0.44% 2.29ms 2.15ms 🟢 -6.09% 🔴 196%
instantiate/
wasm_kernel
64.67µs 65.03µs ⚪ -0.65% 68.02µs 72.08µs 🔴 4.35% 🟢 11%
translate/
erc1155
210.66µs 208.10µs 🟢 -1.55% 385.68µs 386.38µs ⚪ 0.06% 🟡 86%
translate/
erc20
103.89µs 103.08µs ⚪ -0.91% 189.96µs 190.23µs ⚪ 0.01% 🟡 85%
translate/
erc721
148.37µs 145.80µs 🟢 -2.00% 276.41µs 276.86µs ⚪ 0.21% 🟡 90%
translate/
spidermonkey
0.00ns 72.23ms ⚪ -0.49% 0.00ns 0.00ns ⚪ 1.11% 🟢 -100%
translate/
wasm_kernel
3.80ms 3.77ms ⚪ -0.84% 7.12ms 7.17ms ⚪ 0.62% 🟡 90%

Link to pipeline

@Robbepop Robbepop merged commit e840f78 into master Feb 10, 2023
@Robbepop Robbepop deleted the rf-add-func-new branch February 10, 2023 10:57
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.

Implement Wasmtime's Func::new constructor for dynamic function arguments and results
2 participants