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

perf(gas)!: Merge two globals into one #2948

Merged
merged 30 commits into from
Aug 6, 2023
Merged

perf(gas)!: Merge two globals into one #2948

merged 30 commits into from
Aug 6, 2023

Conversation

breathx
Copy link
Member

@breathx breathx commented Jul 15, 2023

Resolves #2891.

PR still in progress but can be reviewed for general logic. Label is to force CI.

TODO:

  • Consider global and syscall renaming
  • Introduce LazyPagesVersion::Version2 and first time use it in code to support old runtimes

@breathx breathx added A0-pleasereview PR is ready to be reviewed by the team D6-gas Change gas charging logic or weights D7-performance Increase our node/runtime/programs execution work performance B1-releasenotes The feature deserves to be added to the Release Notes labels Jul 15, 2023
common/lazy-pages/src/lib.rs Outdated Show resolved Hide resolved
core-backend/common/src/funcs.rs Outdated Show resolved Hide resolved
core-backend/common/src/lib.rs Outdated Show resolved Hide resolved
core-backend/sandbox/src/runtime.rs Outdated Show resolved Hide resolved
core-processor/src/executor.rs Outdated Show resolved Hide resolved
core-processor/src/ext.rs Outdated Show resolved Hide resolved
core-processor/src/ext.rs Outdated Show resolved Hide resolved
lazy-pages/src/globals.rs Show resolved Hide resolved
lazy-pages/src/lib.rs Outdated Show resolved Hide resolved
utils/wasm-instrument/src/lib.rs Outdated Show resolved Hide resolved
@breathx breathx marked this pull request as ready for review July 19, 2023 17:52
Copy link
Member

@ukint-vs ukint-vs left a comment

Choose a reason for hiding this comment

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

good work

Copy link
Member

@gshep gshep left a comment

Choose a reason for hiding this comment

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

🚀

utils/wasm-instrument/src/lib.rs Outdated Show resolved Hide resolved
utils/wasm-instrument/Cargo.toml Show resolved Hide resolved
core-processor/src/ext.rs Outdated Show resolved Hide resolved
Copy link
Member

@grishasobol grishasobol left a comment

Choose a reason for hiding this comment

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

Sorry for late review. Tomorrow second part

core/src/gas.rs Outdated Show resolved Hide resolved
core-backend/common/src/funcs.rs Outdated Show resolved Hide resolved
core-backend/common/src/lazy_pages.rs Outdated Show resolved Hide resolved
core-processor/src/ext.rs Outdated Show resolved Hide resolved
core-backend/common/src/memory.rs Show resolved Hide resolved
lazy-pages/src/globals.rs Outdated Show resolved Hide resolved
utils/wasm-instrument/Cargo.toml Show resolved Hide resolved
utils/wasm-instrument/src/lib.rs Outdated Show resolved Hide resolved
@breathx breathx added A2-mergeoncegreen PR is ready to merge after CI passes and removed A0-pleasereview PR is ready to be reviewed by the team labels Aug 3, 2023
@ukint-vs
Copy link
Member

ukint-vs commented Aug 3, 2023

Host-fn comparison

name master merge-globals diff
alloc 8.1 µs 7.0 µs +15.89%
alloc_per_page 426.6 ns 388.2 ns +9.87%
free 2.1 µs 1.5 µs +39.68%
gr_reserve_gas 4.3 µs 3.6 µs +17.28%
gr_unreserve_gas 4.7 µs 4.0 µs +18.83%
gr_system_reserve_gas 2.9 µs 2.3 µs +26.00%
gr_gas_available 2.9 µs 2.3 µs +28.59%
gr_message_id 2.9 µs 2.3 µs +27.24%
gr_pay_program_rent 50.6 ns 44.0 ns +14.98%
gr_program_id 2.9 µs 2.3 µs +27.82%
gr_source 2.9 µs 2.3 µs +28.34%
gr_value 2.9 µs 2.3 µs +27.54%
gr_value_available 2.9 µs 2.3 µs +26.17%
gr_size 3.0 µs 2.3 µs +29.21%
gr_read 4.0 µs 3.3 µs +19.89%
gr_read_per_byte 162 ps 162 ps +0.00%
gr_block_height 2.9 µs 2.3 µs +28.55%
gr_block_timestamp 2.9 µs 2.3 µs +27.08%
gr_random 3.7 µs 3.1 µs +19.67%
gr_reply_deposit 8.7 µs 8.5 µs +1.96%
gr_send 5.6 µs 4.9 µs +14.08%
gr_send_per_byte 262 ps 269 ps -2.60%
gr_send_wgas 5.6 µs 5.0 µs +12.80%
gr_send_wgas_per_byte 262 ps 261 ps +0.38%
gr_send_init 3.1 µs 2.4 µs +28.00%
gr_send_push 4.2 µs 3.6 µs +19.02%
gr_send_push_per_byte 381 ps 382 ps -0.26%
gr_send_commit 4.9 µs 4.2 µs +15.36%
gr_send_commit_wgas 5.1 µs 4.4 µs +16.08%
gr_reservation_send 5.7 µs 5.1 µs +13.38%
gr_reservation_send_per_byte 258 ps 263 ps -1.90%
gr_reservation_send_commit 5.1 µs 4.5 µs +13.11%
gr_reply_commit 20.0 µs 25.9 µs -22.58%
gr_reply_commit_wgas 21.3 µs 25.9 µs -17.81%
gr_reservation_reply 12.4 µs 13.3 µs -6.85%
gr_reservation_reply_per_byte 428.1 ns 433.8 ns -1.32%
gr_reservation_reply_commit 12.5 µs 7.7 µs +62.72%
gr_reply_push 4.1 µs 3.4 µs +19.86%
gr_reply 20.8 µs 20.2 µs +3.10%
gr_reply_per_byte 417 ps 417 ps +0.00%
gr_reply_wgas 19.1 µs 24.2 µs -20.89%
gr_reply_wgas_per_byte 414 ps 416 ps -0.48%
gr_reply_push_per_byte 628 ps 646 ps -2.79%
gr_reply_to 2.9 µs 2.3 µs +27.32%
gr_signal_from 2.9 µs 2.3 µs +27.51%
gr_reply_input 36.3 µs 7.0 µs +416.48%
gr_reply_input_wgas 1.8 µs 43.8 µs -95.94%
gr_reply_push_input 3.1 µs 2.5 µs +25.17%
gr_reply_push_input_per_byte 143 ps 160 ps -10.62%
gr_send_input 5.8 µs 5.1 µs +11.85%
gr_send_input_wgas 5.8 µs 5.2 µs +12.89%
gr_send_push_input 3.3 µs 2.7 µs +24.23%
gr_send_push_input_per_byte 166 ps 168 ps -1.19%
gr_debug 3.1 µs 2.5 µs +23.82%
gr_debug_per_byte 311 ps 318 ps -2.20%
gr_reply_code 2.9 µs 2.3 µs +25.50%
gr_exit 30.0 µs 27.2 µs +10.30%
gr_leave 17.1 µs 14.6 µs +16.97%
gr_wait 15.2 µs 15.5 µs -1.76%
gr_wait_for 15.7 µs 14.1 µs +10.88%
gr_wait_up_to 14.5 µs 13.4 µs +8.64%
gr_wake 4.2 µs 3.5 µs +19.15%
gr_create_program 6.6 µs 5.9 µs +11.71%
gr_create_program_payload_per_byte 88 ps 99 ps -11.11%
gr_create_program_salt_per_byte 2.1 ns 2.2 ns -2.58%
gr_create_program_wgas 6.7 µs 6.0 µs +11.34%
gr_create_program_wgas_payload_per_byte 84 ps 97 ps -13.40%
gr_create_program_wgas_salt_per_byte 2.2 ns 2.2 ns -2.36%

@breathx breathx merged commit a3241f7 into master Aug 6, 2023
11 checks passed
@breathx breathx deleted the dn-merge-globals branch August 6, 2023 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A2-mergeoncegreen PR is ready to merge after CI passes B1-releasenotes The feature deserves to be added to the Release Notes D6-gas Change gas charging logic or weights D7-performance Increase our node/runtime/programs execution work performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: change two gas counter globals to one
4 participants