-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Improve XCMP weight metering #7963
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
Conversation
72c3dee to
3100f6e
Compare
ec8018e to
e2dc043
Compare
e2dc043 to
4b7b77d
Compare
|
/cmd bench --pallet cumulus_pallet_xcmp_queue |
|
Command "bench --pallet cumulus_pallet_xcmp_queue" has started 🚀 See logs here |
…us_pallet_xcmp_queue'
|
Command "bench --pallet cumulus_pallet_xcmp_queue" has failed ❌! See logs here DetailsCommand output:✅ Successful benchmarks of runtimes/pallets: |
- replace `do_enqueue_message()` with `do_enqueue_messages()` which batches by default. This improves the performance of `enqueue_messages()` while keeing the same performance for `enqueue_message()` - make `message_queue::do_enqueue_message()` logic easier to follow
|
Merging the PR since it has the required approves. I will get back with a follow-up PR with batching and accuracy improvements soon |
855c47b
This is a follow-up for #7963 #7963 introduced some [performance improvements for the message_queue enqueuing logic](ae657d6). This PR leverages those improvements by implementing batching in the XCMP queue pallet. Also the PR increases the weight metering accuracy for the enqueuing logic. The performance difference can be seen in [this commit](1d6c426): ``` fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` // Minimum execution time: 134_166_000 picoseconds. Weight::from_parts(138_915_000, 5487) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } fn enqueue_1000_small_xcmp_messages_individually() -> Weight { // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` // Minimum execution time: 10_181_142_000 picoseconds. Weight::from_parts(10_200_139_000, 5487) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } ``` For 1000 messages of 3 bytes each it takes `134us` to enqueue them using batching and `10181us` to enqueue them individually. This is a ~75x improvement. --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
* master: (26 commits) Snowbridge V2 (#7402) [AHM] Revert multi-block election, slashing and staking client pallets (#7939) docs: update local ci execution instruction (#8003) Upgrade deps to eliminate ancient dependencies (#7999) Removed `pallet:getter` from XCM pallets (#7916) Add digest processor xcm emulator (#7915) Fix: [Referenda Tracks] Resolve representation issues that are breaking PJS apps (#7671) Improve XCMP weight metering (#7963) bump version of zombienet-sdk (#7964) rpc-v2/archive: Rename archive call method result to value (#7885) Bump parachains runtime api to 13 (#7981) `bp-runtime`: make macro expansion not rely on `sp-std` in scope. (#7978) [CI/CD] Refactor backports flow so that it can determine automatically where to do a backport based on labels (#7976) Treasury: update expire date on payout (#7958) (#7959) `fatxpool`: report_invalid: do not ban Future/Stale txs from re-entering the view (#7777) Fix XCM Barrier Rejection Handling to Return Incomplete with Weight (#7843) Bump openssl from 0.10.64 to 0.10.70 (#7442) runtime-api: remove redundant version checks (#7610) Upgrade link-checker cache to v4 (#7874) Updating readmes (#7950) ...
This is a follow-up for #7963 #7963 introduced some [performance improvements for the message_queue enqueuing logic](ae657d6). This PR leverages those improvements by implementing batching in the XCMP queue pallet. Also the PR increases the weight metering accuracy for the enqueuing logic. The performance difference can be seen in [this commit](1d6c426): ``` fn enqueue_1000_small_xcmp_messages() -> Weight { // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` // Minimum execution time: 134_166_000 picoseconds. Weight::from_parts(138_915_000, 5487) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } fn enqueue_1000_small_xcmp_messages_individually() -> Weight { // Proof Size summary in bytes: // Measured: `151` // Estimated: `5487` // Minimum execution time: 10_181_142_000 picoseconds. Weight::from_parts(10_200_139_000, 5487) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } ``` For 1000 messages of 3 bytes each it takes `134us` to enqueue them using batching and `10181us` to enqueue them individually. This is a ~75x improvement. --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
This PR Improves the weight metering for the
enqueue_xcmp_message()method, by accounting for cached reads/writes and for the size of the enqueued messages