mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-11-20 09:36:10 +00:00
Speed up storage iteration from within the runtime (#13479)
* Speed up storage iteration from within the runtime * Move the cached iterator into an `Option` * Use `RefCell` in no_std * Simplify the code slightly * Use `Option::replace` * Update doc comment for `next_storage_key_slow`
This commit is contained in:
1 parent
20bf3c938e
commit
55263fa2a1
9 files changed
+118
-16
No files matched your search
@@ -316,6 +316,19 @@ frame_benchmarking::benchmarks! {
|
||||
call.dispatch_bypass_filter(RawOrigin::Root.into()).unwrap();
|
||||
}
|
||||
|
||||
storage_iteration {
|
||||
for i in 0..65000 {
|
||||
UnboundedMapTwox::<T>::insert(i, sp_std::vec![0; 64]);
|
||||
}
|
||||
}: {
|
||||
for (key, value) in UnboundedMapTwox::<T>::iter() {
|
||||
unsafe {
|
||||
core::ptr::read_volatile(&key);
|
||||
core::ptr::read_volatile(value.as_ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl_benchmark_test_suite!(
|
||||
Pallet,
|
||||
mock::new_test_ext(),
|
||||
|
||||
Reference in new issue
Block a user