Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions prdoc/pr_11069.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: 'frame-omni-bencher: enable jemalloc-allocator'
doc:
- audience: Runtime Dev
description: |-
Fix huge benchmark regression for storage-heavy extrinsics, enabling jemalloc-allocator via polkadot-jemalloc-shim for omni-bencher, marked as optional in the scope of PR #10590.
Revert also the dummy write/read workaround at the end of commit_db() introduced by #10947.
crates:
- name: frame-omni-bencher
bump: patch
- name: frame-benchmarking
bump: patch
13 changes: 0 additions & 13 deletions substrate/frame/benchmarking/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,6 @@ pub trait Benchmarking {
/// Commit pending storage changes to the trie database and clear the database cache.
fn commit_db(&mut self) {
self.commit();

// Warmup the memory allocator after bulk deallocation.
// After draining the overlay with many entries, the first new allocation can trigger memory
// defragmentation. The warmup key is whitelisted so these operations don't appear in
// benchmark results.
const WARMUP_KEY: &[u8] = b":benchmark_warmup:";
let mut whitelist = self.get_whitelist();
if !whitelist.iter().any(|k| k.key == WARMUP_KEY) {
whitelist.push(WARMUP_KEY.to_vec().into());
self.set_whitelist(whitelist);
}
self.place_storage(WARMUP_KEY.to_vec(), Some(vec![0u8; 32]));
self.place_storage(WARMUP_KEY.to_vec(), None);
}

/// Get the read/write count.
Expand Down
5 changes: 5 additions & 0 deletions substrate/utils/frame/omni-bencher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ clap = { features = ["derive"], workspace = true }
cumulus-primitives-proof-size-hostfunction.default-features = true
cumulus-primitives-proof-size-hostfunction.workspace = true
frame-benchmarking-cli.workspace = true
polkadot-jemalloc-shim.workspace = true
sc-cli.default-features = true
sc-cli.workspace = true
sp-runtime.default-features = true
Expand All @@ -24,6 +25,10 @@ sp-statement-store.default-features = true
sp-statement-store.workspace = true
tracing-subscriber = { workspace = true }

[target.'cfg(target_os = "linux")'.dependencies]
# Jemalloc as global allocator prevents huge benchmark regression for storage-heavy extrinsics.
polkadot-jemalloc-shim = { workspace = true, features = ["jemalloc-allocator"] }

[dev-dependencies]
assert_cmd = { workspace = true }
cumulus-test-runtime = { workspace = true }
Expand Down
Loading