git.delta.rocks / unique-network / refs/commits / 87c401906db8

difftreelog

feat bench bulk mints

Yaroslav Bolyukin2021-08-31parent: #c2620ab.patch.diff
in: master

2 files changed

modifiedpallets/nft/src/benchmarking.rsdiffbeforeafterboth
162 });162 });
163 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)163 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
164
165 create_multiple_items_nft {
166 // TODO: Take item data size into account. As create_item_nft bench shows, this parameter has no effect on execution time,
167 // but it may if we increase CUSTOM_DATA_LIMIT
168 let b in 1..1000;
169
170 let caller: T::AccountId = account("caller", 0, SEED);
171 let collection = create_nft_collection::<T>(caller.clone())?;
172 let data = (0..b).map(|_| default_nft_data()).collect();
173 }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
164174
165 // fungible item175 // fungible item
166 create_item_fungible {176 create_item_fungible {
171 });181 });
172 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)182 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
183
184 create_multiple_items_fungible {
185 let b in 1..1000;
186
187 let caller: T::AccountId = account("caller", 0, SEED);
188 let collection = create_fungible_collection::<T>(caller.clone())?;
189 let data = (0..b).map(|_| default_fungible_data()).collect();
190 }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
173191
174 // refungible item192 // refungible item
175 create_item_refungible {193 create_item_refungible {
184 });202 });
185 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)203 }: create_item(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
204
205 create_multiple_items_refungible {
206 // TODO: Take item data size into account. As create_item_nft bench shows, this parameter has no effect on execution time,
207 // but it may if we increase CUSTOM_DATA_LIMIT
208 let b in 1..1000;
209
210 let caller: T::AccountId = account("caller", 0, SEED);
211 let collection = create_refungible_collection::<T>(caller.clone())?;
212 let data = (0..b).map(|_| default_re_fungible_data()).collect();
213 }: create_multiple_items(RawOrigin::Signed(caller.clone()), collection, T::CrossAccountId::from_sub(caller.clone()), data)
186214
187 burn_item_nft {215 burn_item_nft {
188 let caller: T::AccountId = account("caller", 0, SEED);216 let caller: T::AccountId = account("caller", 0, SEED);
215 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?;243 <Pallet<T>>::create_item(RawOrigin::Signed(caller.clone()).into(), collection, T::CrossAccountId::from_sub(caller.clone()), data)?;
216 }: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1)244 }: transfer(RawOrigin::Signed(caller.clone()), T::CrossAccountId::from_sub(recipient.clone()), collection, 1, 1)
245
246 set_transfers_enabled_flag {
247 let caller: T::AccountId = account("caller", 0, SEED);
248 let collection = create_nft_collection::<T>(caller.clone())?;
249 }: _(RawOrigin::Signed(caller.clone()), collection, false)
217250
218 approve_nft {251 approve_nft {
219 let caller: T::AccountId = account("caller", 0, SEED);252 let caller: T::AccountId = account("caller", 0, SEED);
modifiedpallets/nft/src/weights.rsdiffbeforeafterboth
--- a/pallets/nft/src/weights.rs
+++ b/pallets/nft/src/weights.rs
@@ -3,7 +3,7 @@
 //! Autogenerated weights for pallet_nft
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
-//! DATE: 2021-08-30, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2021-08-31, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
 //! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128
 
 // Executed Command:
@@ -44,12 +44,16 @@
 	fn confirm_sponsorship() -> Weight;
 	fn remove_collection_sponsor() -> Weight;
 	fn create_item_nft(b: u32, ) -> Weight;
+	fn create_multiple_items_nft(b: u32, ) -> Weight;
 	fn create_item_fungible() -> Weight;
+	fn create_multiple_items_fungible(b: u32, ) -> Weight;
 	fn create_item_refungible(b: u32, ) -> Weight;
+	fn create_multiple_items_refungible(b: u32, ) -> Weight;
 	fn burn_item_nft() -> Weight;
 	fn transfer_nft() -> Weight;
 	fn transfer_fungible() -> Weight;
 	fn transfer_refungible() -> Weight;
+	fn set_transfers_enabled_flag() -> Weight;
 	fn approve_nft() -> Weight;
 	fn transfer_from_nft() -> Weight;
 	fn transfer_from_fungible() -> Weight;
@@ -130,8 +134,23 @@
 			.saturating_add(T::DbWeight::get().reads(11 as Weight))
 			.saturating_add(T::DbWeight::get().writes(8 as Weight))
 	}
+	fn create_multiple_items_nft(b: u32, ) -> Weight {
+		(336_830_000 as Weight)
+			// Standard Error: 42_000
+			.saturating_add((11_627_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(T::DbWeight::get().reads(11 as Weight))
+			.saturating_add(T::DbWeight::get().writes(7 as Weight))
+			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
+	}
 	fn create_item_fungible() -> Weight {
-		(22_331_000 as Weight)
+		(24_123_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(9 as Weight))
+			.saturating_add(T::DbWeight::get().writes(4 as Weight))
+	}
+	fn create_multiple_items_fungible(b: u32, ) -> Weight {
+		(48_227_000 as Weight)
+			// Standard Error: 13_000
+			.saturating_add((2_918_000 as Weight).saturating_mul(b as Weight))
 			.saturating_add(T::DbWeight::get().reads(9 as Weight))
 			.saturating_add(T::DbWeight::get().writes(4 as Weight))
 	}
@@ -140,6 +159,14 @@
 			.saturating_add(T::DbWeight::get().reads(9 as Weight))
 			.saturating_add(T::DbWeight::get().writes(7 as Weight))
 	}
+	fn create_multiple_items_refungible(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 16_000
+			.saturating_add((8_374_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(T::DbWeight::get().reads(9 as Weight))
+			.saturating_add(T::DbWeight::get().writes(6 as Weight))
+			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
+	}
 	fn burn_item_nft() -> Weight {
 		(32_237_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(9 as Weight))
@@ -160,6 +187,11 @@
 			.saturating_add(T::DbWeight::get().reads(10 as Weight))
 			.saturating_add(T::DbWeight::get().writes(7 as Weight))
 	}
+	fn set_transfers_enabled_flag() -> Weight {
+		(6_376_000 as Weight)
+			.saturating_add(T::DbWeight::get().reads(1 as Weight))
+			.saturating_add(T::DbWeight::get().writes(1 as Weight))
+	}
 	fn approve_nft() -> Weight {
 		(169_825_000 as Weight)
 			.saturating_add(T::DbWeight::get().reads(9 as Weight))
@@ -274,13 +306,30 @@
 			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
 	}
-	fn create_item_nft(_b: u32, ) -> Weight {
-		(167_909_000 as Weight)
+	fn create_item_nft(b: u32, ) -> Weight {
+		(167_180_000 as Weight)
+			// Standard Error: 1_000
+			.saturating_add((10_000 as Weight).saturating_mul(b as Weight))
 			.saturating_add(RocksDbWeight::get().reads(11 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(8 as Weight))
 	}
+	fn create_multiple_items_nft(b: u32, ) -> Weight {
+		(336_830_000 as Weight)
+			// Standard Error: 42_000
+			.saturating_add((11_627_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(RocksDbWeight::get().reads(11 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(7 as Weight))
+			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
+	}
 	fn create_item_fungible() -> Weight {
-		(22_331_000 as Weight)
+		(24_123_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
+	}
+	fn create_multiple_items_fungible(b: u32, ) -> Weight {
+		(13_217_000 as Weight)
+			// Standard Error: 4_000
+			.saturating_add((2_971_000 as Weight).saturating_mul(b as Weight))
 			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
 	}
@@ -289,6 +338,14 @@
 			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(7 as Weight))
 	}
+	fn create_multiple_items_refungible(b: u32, ) -> Weight {
+		(0 as Weight)
+			// Standard Error: 16_000
+			.saturating_add((8_374_000 as Weight).saturating_mul(b as Weight))
+			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(6 as Weight))
+			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(b as Weight)))
+	}
 	fn burn_item_nft() -> Weight {
 		(32_237_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(9 as Weight))
@@ -309,6 +366,11 @@
 			.saturating_add(RocksDbWeight::get().reads(10 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(7 as Weight))
 	}
+	fn set_transfers_enabled_flag() -> Weight {
+		(6_376_000 as Weight)
+			.saturating_add(RocksDbWeight::get().reads(1 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(1 as Weight))
+	}
 	fn approve_nft() -> Weight {
 		(169_825_000 as Weight)
 			.saturating_add(RocksDbWeight::get().reads(9 as Weight))