difftreelog
feat bench bulk mints
in: master
2 files changed
pallets/nft/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nft/src/benchmarking.rs
+++ b/pallets/nft/src/benchmarking.rs
@@ -162,6 +162,16 @@
});
}: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
+ create_multiple_items_nft {
+ // TODO: Take item data size into account. As create_item_nft bench shows, this parameter has no effect on execution time,
+ // but it may if we increase CUSTOM_DATA_LIMIT
+ let b in 1..1000;
+
+ let caller: T::AccountId = account("caller", 0, SEED);
+ let collection = create_nft_collection::<T>(caller.clone())?;
+ let data = (0..b).map(|_| default_nft_data()).collect();
+ }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
+
// fungible item
create_item_fungible {
let caller: T::AccountId = account("caller", 0, SEED);
@@ -171,6 +181,14 @@
});
}: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
+ create_multiple_items_fungible {
+ let b in 1..1000;
+
+ let caller: T::AccountId = account("caller", 0, SEED);
+ let collection = create_fungible_collection::<T>(caller.clone())?;
+ let data = (0..b).map(|_| default_fungible_data()).collect();
+ }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
+
// refungible item
create_item_refungible {
let b in 0..(CUSTOM_DATA_LIMIT * 2);
@@ -184,6 +202,16 @@
});
}: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
+ create_multiple_items_refungible {
+ // TODO: Take item data size into account. As create_item_nft bench shows, this parameter has no effect on execution time,
+ // but it may if we increase CUSTOM_DATA_LIMIT
+ let b in 1..1000;
+
+ let caller: T::AccountId = account("caller", 0, SEED);
+ let collection = create_refungible_collection::<T>(caller.clone())?;
+ let data = (0..b).map(|_| default_re_fungible_data()).collect();
+ }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
+
burn_item_nft {
let caller: T::AccountId = account("caller", 0, SEED);
let collection = create_nft_collection::<T>(caller.clone())?;
@@ -215,6 +243,11 @@
<Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?;
}: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1)
+ set_transfers_enabled_flag {
+ let caller: T::AccountId = account("caller", 0, SEED);
+ let collection = create_nft_collection::<T>(caller.clone())?;
+ }: _(RawOrigin::Signed(caller.clone()), collection, false)
+
approve_nft {
let caller: T::AccountId = account("caller", 0, SEED);
let collection = create_nft_collection::<T>(caller.clone())?;
pallets/nft/src/weights.rsdiffbeforeafterboth3//! Autogenerated weights for pallet_nft3//! Autogenerated weights for pallet_nft4//!4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.05//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.06//! DATE: 2021-08-30, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2021-08-31, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1287//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128889// Executed Command:9// Executed Command:44 fn confirm_sponsorship() -> Weight;44 fn confirm_sponsorship() -> Weight;45 fn remove_collection_sponsor() -> Weight;45 fn remove_collection_sponsor() -> Weight;46 fn create_item_nft(b: u32, ) -> Weight;46 fn create_item_nft(b: u32, ) -> Weight;47 fn create_multiple_items_nft(b: u32, ) -> Weight;47 fn create_item_fungible() -> Weight;48 fn create_item_fungible() -> Weight;49 fn create_multiple_items_fungible(b: u32, ) -> Weight;48 fn create_item_refungible(b: u32, ) -> Weight;50 fn create_item_refungible(b: u32, ) -> Weight;51 fn create_multiple_items_refungible(b: u32, ) -> Weight;49 fn burn_item_nft() -> Weight;52 fn burn_item_nft() -> Weight;50 fn transfer_nft() -> Weight;53 fn transfer_nft() -> Weight;51 fn transfer_fungible() -> Weight;54 fn transfer_fungible() -> Weight;52 fn transfer_refungible() -> Weight;55 fn transfer_refungible() -> Weight;56 fn set_transfers_enabled_flag() -> Weight;53 fn approve_nft() -> Weight;57 fn approve_nft() -> Weight;54 fn transfer_from_nft() -> Weight;58 fn transfer_from_nft() -> Weight;55 fn transfer_from_fungible() -> Weight;59 fn transfer_from_fungible() -> Weight;130 .saturating_add(T::DbWeight::get().reads(11 as Weight))134 .saturating_add(T::DbWeight::get().reads(11 as Weight))131 .saturating_add(T::DbWeight::get().writes(8 as Weight))135 .saturating_add(T::DbWeight::get().writes(8 as Weight))132 }136 }137 fn create_multiple_items_nft(b: u32, ) -> Weight {138 (336_830_000 as Weight)139 // Standard Error: 42_000140 .saturating_add((11_627_000 as Weight).saturating_mul(b as Weight))141 .saturating_add(T::DbWeight::get().reads(11 as Weight))142 .saturating_add(T::DbWeight::get().writes(7 as Weight))143 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))144 }133 fn create_item_fungible() -> Weight {145 fn create_item_fungible() -> Weight {134 (22_331_000 as Weight)146 (24_123_000 as Weight)135 .saturating_add(T::DbWeight::get().reads(9 as Weight))147 .saturating_add(T::DbWeight::get().reads(9 as Weight))136 .saturating_add(T::DbWeight::get().writes(4 as Weight))148 .saturating_add(T::DbWeight::get().writes(4 as Weight))137 }149 }150 fn create_multiple_items_fungible(b: u32, ) -> Weight {151 (48_227_000 as Weight)152 // Standard Error: 13_000153 .saturating_add((2_918_000 as Weight).saturating_mul(b as Weight))154 .saturating_add(T::DbWeight::get().reads(9 as Weight))155 .saturating_add(T::DbWeight::get().writes(4 as Weight))156 }138 fn create_item_refungible(_b: u32, ) -> Weight {157 fn create_item_refungible(_b: u32, ) -> Weight {139 (26_293_000 as Weight)158 (26_293_000 as Weight)140 .saturating_add(T::DbWeight::get().reads(9 as Weight))159 .saturating_add(T::DbWeight::get().reads(9 as Weight))141 .saturating_add(T::DbWeight::get().writes(7 as Weight))160 .saturating_add(T::DbWeight::get().writes(7 as Weight))142 }161 }162 fn create_multiple_items_refungible(b: u32, ) -> Weight {163 (0 as Weight)164 // Standard Error: 16_000165 .saturating_add((8_374_000 as Weight).saturating_mul(b as Weight))166 .saturating_add(T::DbWeight::get().reads(9 as Weight))167 .saturating_add(T::DbWeight::get().writes(6 as Weight))168 .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))169 }143 fn burn_item_nft() -> Weight {170 fn burn_item_nft() -> Weight {144 (32_237_000 as Weight)171 (32_237_000 as Weight)145 .saturating_add(T::DbWeight::get().reads(9 as Weight))172 .saturating_add(T::DbWeight::get().reads(9 as Weight))160 .saturating_add(T::DbWeight::get().reads(10 as Weight))187 .saturating_add(T::DbWeight::get().reads(10 as Weight))161 .saturating_add(T::DbWeight::get().writes(7 as Weight))188 .saturating_add(T::DbWeight::get().writes(7 as Weight))162 }189 }190 fn set_transfers_enabled_flag() -> Weight {191 (6_376_000 as Weight)192 .saturating_add(T::DbWeight::get().reads(1 as Weight))193 .saturating_add(T::DbWeight::get().writes(1 as Weight))194 }163 fn approve_nft() -> Weight {195 fn approve_nft() -> Weight {164 (169_825_000 as Weight)196 (169_825_000 as Weight)165 .saturating_add(T::DbWeight::get().reads(9 as Weight))197 .saturating_add(T::DbWeight::get().reads(9 as Weight))274 .saturating_add(RocksDbWeight::get().reads(1 as Weight))306 .saturating_add(RocksDbWeight::get().reads(1 as Weight))275 .saturating_add(RocksDbWeight::get().writes(1 as Weight))307 .saturating_add(RocksDbWeight::get().writes(1 as Weight))276 }308 }277 fn create_item_nft(_b: u32, ) -> Weight {309 fn create_item_nft(b: u32, ) -> Weight {278 (167_909_000 as Weight)310 (167_180_000 as Weight)311 // Standard Error: 1_000312 .saturating_add((10_000 as Weight).saturating_mul(b as Weight))279 .saturating_add(RocksDbWeight::get().reads(11 as Weight))313 .saturating_add(RocksDbWeight::get().reads(11 as Weight))280 .saturating_add(RocksDbWeight::get().writes(8 as Weight))314 .saturating_add(RocksDbWeight::get().writes(8 as Weight))281 }315 }316 fn create_multiple_items_nft(b: u32, ) -> Weight {317 (336_830_000 as Weight)318 // Standard Error: 42_000319 .saturating_add((11_627_000 as Weight).saturating_mul(b as Weight))320 .saturating_add(RocksDbWeight::get().reads(11 as Weight))321 .saturating_add(RocksDbWeight::get().writes(7 as Weight))322 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))323 }282 fn create_item_fungible() -> Weight {324 fn create_item_fungible() -> Weight {283 (22_331_000 as Weight)325 (24_123_000 as Weight)284 .saturating_add(RocksDbWeight::get().reads(9 as Weight))326 .saturating_add(RocksDbWeight::get().reads(9 as Weight))285 .saturating_add(RocksDbWeight::get().writes(4 as Weight))327 .saturating_add(RocksDbWeight::get().writes(4 as Weight))286 }328 }329 fn create_multiple_items_fungible(b: u32, ) -> Weight {330 (13_217_000 as Weight)331 // Standard Error: 4_000332 .saturating_add((2_971_000 as Weight).saturating_mul(b as Weight))333 .saturating_add(RocksDbWeight::get().reads(9 as Weight))334 .saturating_add(RocksDbWeight::get().writes(4 as Weight))335 }287 fn create_item_refungible(_b: u32, ) -> Weight {336 fn create_item_refungible(_b: u32, ) -> Weight {288 (26_293_000 as Weight)337 (26_293_000 as Weight)289 .saturating_add(RocksDbWeight::get().reads(9 as Weight))338 .saturating_add(RocksDbWeight::get().reads(9 as Weight))290 .saturating_add(RocksDbWeight::get().writes(7 as Weight))339 .saturating_add(RocksDbWeight::get().writes(7 as Weight))291 }340 }341 fn create_multiple_items_refungible(b: u32, ) -> Weight {342 (0 as Weight)343 // Standard Error: 16_000344 .saturating_add((8_374_000 as Weight).saturating_mul(b as Weight))345 .saturating_add(RocksDbWeight::get().reads(9 as Weight))346 .saturating_add(RocksDbWeight::get().writes(6 as Weight))347 .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))348 }292 fn burn_item_nft() -> Weight {349 fn burn_item_nft() -> Weight {293 (32_237_000 as Weight)350 (32_237_000 as Weight)294 .saturating_add(RocksDbWeight::get().reads(9 as Weight))351 .saturating_add(RocksDbWeight::get().reads(9 as Weight))309 .saturating_add(RocksDbWeight::get().reads(10 as Weight))366 .saturating_add(RocksDbWeight::get().reads(10 as Weight))310 .saturating_add(RocksDbWeight::get().writes(7 as Weight))367 .saturating_add(RocksDbWeight::get().writes(7 as Weight))311 }368 }369 fn set_transfers_enabled_flag() -> Weight {370 (6_376_000 as Weight)371 .saturating_add(RocksDbWeight::get().reads(1 as Weight))372 .saturating_add(RocksDbWeight::get().writes(1 as Weight))373 }312 fn approve_nft() -> Weight {374 fn approve_nft() -> Weight {313 (169_825_000 as Weight)375 (169_825_000 as Weight)314 .saturating_add(RocksDbWeight::get().reads(9 as Weight))376 .saturating_add(RocksDbWeight::get().reads(9 as Weight))