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

Defer charging fuel for bulk table and bulk memory operations #676

Merged
merged 12 commits into from
Feb 13, 2023

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Feb 13, 2023

Fuel checks are still happening before the bulk operation execution but fuel charging only happens if those operations succeeded.
This make sense given that all of these bulk operations fail fast. So only if they succeeded they actually performed a lot of potential computation.

This affects the following Wasm bulk operations:

  • memory.grow: Already implemented deferred fuel charging but this implementation improves upon it.
  • memory.fill
  • memory.copy
  • data.init
  • table.grow
  • table.fill
  • table.copy
  • elem.init

@paritytech-cicd-pr
Copy link

paritytech-cicd-pr commented Feb 13, 2023

BENCHMARKS

NATIVEWASMTIME
BENCHMARKMASTERPRDIFFMASTERPRDIFFWASMTIME OVERHEAD
execute/
bare_call_0
1.48ms 1.45ms 🟢 -1.77% 1.20ms 1.27ms 🔴 5.96% 🟢 -13%
execute/
bare_call_0/typed
1.06ms 1.05ms ⚪ -0.80% 861.52µs 840.21µs 🟢 -2.44% 🟢 -20%
execute/
bare_call_1
1.52ms 1.52ms 🔴 -1.17% 1.43ms 1.55ms 🔴 8.51% 🟢 2%
execute/
bare_call_16
2.36ms 2.46ms 🔴 4.66% 4.31ms 4.40ms 🔴 2.20% 🟡 79%
execute/
bare_call_16/typed
1.56ms 1.57ms ⚪ 0.46% 2.48ms 2.37ms 🟢 -4.53% 🟡 51%
execute/
bare_call_1/typed
1.19ms 1.21ms ⚪ 1.32% 1.22ms 1.26ms 🔴 3.13% 🟢 5%
execute/
bare_call_4
1.66ms 1.65ms ⚪ 0.18% 2.04ms 2.03ms 🟢 -0.40% 🟢 24%
execute/
bare_call_4/typed
1.18ms 1.16ms ⚪ -1.20% 1.31ms 1.28ms 🟢 -2.69% 🟢 10%
execute/
br_table
1.19ms 1.19ms ⚪ 0.06% 1.42ms 1.44ms 🔴 1.62% 🟢 21%
execute/
count_until
651.98µs 642.01µs 🟢 -1.62% 1.98ms 2.29ms 🔴 15.51% 🔴 257%
execute/
factorial_iterative
326.29µs 320.95µs 🟢 -1.84% 916.98µs 962.63µs 🔴 4.89% 🔴 200%
execute/
factorial_recursive
640.98µs 647.83µs 🔴 1.15% 1.38ms 1.31ms 🟢 -5.17% 🔴 102%
execute/
fib_iterative
1.35ms 1.41ms 🔴 3.82% 5.05ms 5.16ms 🔴 2.22% 🔴 267%
execute/
fib_recursive
5.81ms 5.98ms 🔴 2.94% 12.65ms 11.33ms 🟢 -10.41% 🟡 89%
execute/
global_bump
995.40µs 1.04ms 🔴 4.88% 2.64ms 2.65ms ⚪ 0.26% 🔴 155%
execute/
global_const
725.09µs 684.81µs 🟢 -5.57% 2.36ms 2.46ms 🔴 4.26% 🔴 259%
execute/
host_calls
27.88µs 27.75µs ⚪ -0.64% 40.73µs 39.04µs 🟢 -4.12% 🟢 41%
execute/
memory_fill
1.23ms 1.20ms 🟢 -2.73% 4.23ms 4.19ms ⚪ -1.07% 🔴 250%
execute/
memory_sum
1.21ms 1.18ms 🟢 -2.41% 4.13ms 4.15ms ⚪ 0.53% 🔴 253%
execute/
memory_vec_add
2.42ms 2.40ms ⚪ -0.87% 7.97ms 7.78ms 🟢 -2.46% 🔴 224%
execute/
recursive_is_even
1.17ms 1.15ms ⚪ -1.49% 2.28ms 2.32ms 🔴 1.74% 🔴 102%
execute/
recursive_ok
145.94µs 155.66µs 🔴 7.17% 318.82µs 302.54µs 🟢 -5.19% 🟡 94%
execute/
recursive_scan
179.59µs 182.72µs 🔴 1.71% 405.33µs 370.79µs 🟢 -8.47% 🔴 103%
execute/
recursive_trap
14.64µs 15.41µs 🔴 5.67% 34.29µs 30.77µs 🟢 -9.97% 🟡 100%
execute/
regex_redux
528.53µs 564.72µs 🔴 6.62% 1.45ms 1.38ms 🟢 -4.53% 🔴 144%
execute/
rev_complement
468.62µs 467.46µs ⚪ -0.46% 1.44ms 1.43ms ⚪ -1.09% 🔴 205%
execute/
tiny_keccak
328.13µs 328.67µs ⚪ 0.06% 1.17ms 1.15ms 🟢 -1.73% 🔴 248%
execute/
trunc_f2i
707.58µs 692.31µs 🟢 -2.10% 2.28ms 2.15ms 🟢 -5.73% 🔴 210%
instantiate/
wasm_kernel
62.04µs 63.81µs 🔴 2.87% 73.51µs 70.24µs 🟢 -6.03% 🟢 10%
translate/
erc1155
240.63µs 237.60µs ⚪ -1.12% 455.62µs 458.58µs ⚪ 0.34% 🟡 93%
translate/
erc20
117.42µs 115.02µs 🟢 -2.24% 219.92µs 219.18µs ⚪ -0.14% 🟡 91%
translate/
erc721
165.25µs 162.26µs 🟢 -1.85% 321.02µs 319.35µs ⚪ -0.50% 🟡 97%
translate/
spidermonkey
0.00ns 0.00ns ⚪ 0.00% 0.00ns 0.00ns ⚪ -0.30% 🟢 0%
translate/
wasm_kernel
4.09ms 4.06ms ⚪ -0.54% 8.36ms 8.33ms ⚪ -0.26% 🔴 105%

Link to pipeline

@codecov-commenter
Copy link

Codecov Report

Merging #676 (325bdf1) into master (ab65546) will increase coverage by 0.04%.
The diff coverage is 72.93%.

@@            Coverage Diff             @@
##           master     #676      +/-   ##
==========================================
+ Coverage   81.37%   81.41%   +0.04%     
==========================================
  Files         100      100              
  Lines        8386     8417      +31     
==========================================
+ Hits         6824     6853      +29     
- Misses       1562     1564       +2     
Impacted Files Coverage Δ
crates/wasmi/src/error.rs 58.62% <0.00%> (ø)
crates/wasmi/src/func/caller.rs 41.66% <0.00%> (ø)
crates/wasmi/src/store.rs 74.69% <16.66%> (-2.20%) ⬇️
crates/wasmi/src/engine/executor.rs 95.43% <80.17%> (+0.53%) ⬆️
crates/wasmi/src/memory/mod.rs 65.32% <100.00%> (-0.33%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Robbepop Robbepop merged commit 118385c into master Feb 13, 2023
@Robbepop Robbepop deleted the rf-defer-bulk-fuel-metering branch February 13, 2023 19:26
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.

3 participants