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 Pages::checked_sub method #660

Merged
merged 1 commit into from
Feb 9, 2023
Merged

Add Pages::checked_sub method #660

merged 1 commit into from
Feb 9, 2023

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Feb 9, 2023

Closes #659.

This mirrors the already existing Pages::checked_add method.

@tomaka

This mirrors the already existing Pages::checked_add method.
@Robbepop Robbepop changed the title add Pages::checked_sub method Add Pages::checked_sub method Feb 9, 2023
@paritytech-cicd-pr
Copy link

BENCHMARKS

NATIVEWASMTIME
BENCHMARKMASTERPRDIFFMASTERPRDIFFWASMTIME OVERHEAD
execute/
bare_call_0
1.54ms 1.50ms 🟢 -2.67% 1.16ms 1.16ms ⚪ -0.42% 🟢 -23%
execute/
bare_call_0/typed
1.06ms 1.06ms ⚪ -0.65% 759.50µs 758.76µs ⚪ -0.10% 🟢 -28%
execute/
bare_call_1
1.59ms 1.60ms 🔴 1.18% 1.34ms 1.33ms 🔴 -1.09% 🟢 -17%
execute/
bare_call_16
2.45ms 2.42ms ⚪ -1.54% 4.18ms 4.18ms ⚪ 0.09% 🟡 72%
execute/
bare_call_16/typed
1.59ms 1.61ms ⚪ 0.82% 2.27ms 2.27ms ⚪ -0.29% 🟢 41%
execute/
bare_call_1/typed
1.17ms 1.23ms 🔴 4.47% 1.18ms 1.19ms 🔴 1.83% 🟢 -3%
execute/
bare_call_4
1.77ms 1.67ms 🟢 -5.60% 1.97ms 1.96ms ⚪ -0.23% 🟢 17%
execute/
bare_call_4/typed
1.18ms 1.18ms ⚪ 0.08% 1.23ms 1.25ms ⚪ 0.93% 🟢 6%
execute/
br_table
1.19ms 1.32ms 🔴 11.08% 1.43ms 1.44ms ⚪ 1.23% 🟢 9%
execute/
count_until
683.22µs 682.53µs ⚪ -0.09% 2.15ms 2.14ms ⚪ -0.58% 🔴 213%
execute/
factorial_iterative
328.24µs 333.10µs 🔴 1.37% 912.81µs 908.22µs ⚪ -0.51% 🔴 173%
execute/
factorial_recursive
648.92µs 647.92µs ⚪ -0.16% 1.42ms 1.34ms 🟢 -5.42% 🔴 108%
execute/
fib_iterative
1.35ms 1.36ms ⚪ 0.89% 5.03ms 5.02ms ⚪ -0.22% 🔴 268%
execute/
fib_recursive
5.88ms 6.01ms 🔴 2.38% 12.02ms 12.63ms 🔴 5.14% 🔴 110%
execute/
global_bump
959.83µs 960.11µs ⚪ -0.07% 2.57ms 2.56ms ⚪ -0.24% 🔴 167%
execute/
global_const
736.69µs 736.94µs ⚪ -0.05% 2.39ms 2.40ms ⚪ 0.26% 🔴 226%
execute/
host_calls
27.69µs 28.98µs ⚪ 3.26% 39.46µs 38.85µs ⚪ -1.60% 🟢 34%
execute/
memory_fill
1.26ms 1.25ms ⚪ -0.23% 4.03ms 4.03ms ⚪ -0.04% 🔴 221%
execute/
memory_sum
1.22ms 1.22ms ⚪ 0.04% 4.01ms 4.01ms ⚪ -0.02% 🔴 229%
execute/
memory_vec_add
2.50ms 2.60ms 🔴 3.88% 7.62ms 7.62ms ⚪ 0.00% 🔴 193%
execute/
recursive_is_even
1.15ms 1.13ms ⚪ -1.22% 2.19ms 2.19ms ⚪ 0.14% 🟡 94%
execute/
recursive_ok
153.23µs 152.56µs ⚪ -0.42% 310.07µs 311.22µs ⚪ 0.37% 🔴 104%
execute/
recursive_scan
183.18µs 182.46µs ⚪ -0.43% 390.59µs 390.71µs ⚪ -0.05% 🔴 114%
execute/
recursive_trap
15.09µs 15.12µs ⚪ 0.30% 30.99µs 31.93µs 🔴 3.00% 🔴 111%
execute/
regex_redux
537.25µs 534.28µs ⚪ -0.52% 1.39ms 1.37ms 🟢 -1.32% 🔴 156%
execute/
rev_complement
477.43µs 482.52µs ⚪ 1.05% 1.39ms 1.39ms ⚪ -0.14% 🔴 188%
execute/
tiny_keccak
347.15µs 332.28µs 🟢 -3.83% 1.14ms 1.15ms ⚪ 0.23% 🔴 245%
execute/
trunc_f2i
723.33µs 722.42µs ⚪ -0.04% 2.14ms 2.14ms ⚪ 0.00% 🔴 196%
instantiate/
wasm_kernel
64.51µs 64.38µs ⚪ -0.46% 71.33µs 72.05µs 🔴 1.90% 🟢 12%
translate/
erc1155
207.42µs 208.42µs ⚪ 0.16% 385.40µs 387.90µs ⚪ 0.64% 🟡 86%
translate/
erc20
102.87µs 102.90µs ⚪ -0.15% 188.77µs 191.11µs 🔴 1.33% 🟡 86%
translate/
erc721
147.13µs 145.85µs ⚪ -1.03% 275.84µs 277.01µs ⚪ 0.37% 🟡 90%
translate/
spidermonkey
0.00ns 0.00ns ⚪ -0.31% 0.00ns 0.00ns 🔴 1.82% 🟢 0%
translate/
wasm_kernel
3.75ms 3.75ms ⚪ -0.16% 7.10ms 7.17ms ⚪ 0.95% 🟡 91%

Link to pipeline

@Robbepop
Copy link
Member Author

Robbepop commented Feb 9, 2023

@tomaka If the API as implemented in this PR suffices you, I will merge.

@tomaka
Copy link
Contributor

tomaka commented Feb 9, 2023

Yes, in addition to the impl From<Pages> for u32 that already exists this is good for me 👍

@Robbepop Robbepop merged commit e57659e into master Feb 9, 2023
@Robbepop Robbepop deleted the rf-add-pages-checked-sub branch February 9, 2023 15:30
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.

Add Memory::grow_to_minimum or add more utilities to Pages
3 participants