git.delta.rocks / unique-network / refs/commits / 4469adb5861d

difftreelog

feat rmrk-core benchmarking

Yaroslav Bolyukin2022-06-09parent: #d171b11.patch.diff
in: master

11 files changed

modifiedMakefilediffbeforeafterboth
93bench-structure:93bench-structure:
94 make _bench PALLET=structure94 make _bench PALLET=structure
95
96.PHONY: bench-rmrk-core
97bench-rmrk-core:
98 make _bench PALLET=proxy-rmrk-core
9599
96.PHONY: bench100.PHONY: bench
97bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible101bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible
modifiedpallets/common/src/benchmarking.rsdiffbeforeafterboth
109 create_collection_raw(109 create_collection_raw(
110 owner,110 owner,
111 CollectionMode::NFT,111 CollectionMode::NFT,
112 |owner, data| <Pallet<T>>::init_collection(owner, data),112 |owner, data| <Pallet<T>>::init_collection(owner, data, true),
113 |h| h,113 |h| h,
114 )114 )
115}115}
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
427 /// Target collection doesn't supports this operation427 /// Target collection doesn't supports this operation
428 UnsupportedOperation,428 UnsupportedOperation,
429429
430 /// Not sufficient founds to perform action430 /// Not sufficient funds to perform action
431 NotSufficientFounds,431 NotSufficientFounds,
432432
433 /// Collection has nesting disabled433 /// Collection has nesting disabled
modifiedpallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth
51 create_collection_raw(51 create_collection_raw(
52 owner,52 owner,
53 CollectionMode::NFT,53 CollectionMode::NFT,
54 <Pallet<T>>::init_collection,54 |owner, data| <Pallet<T>>::init_collection(owner, data, true),
55 NonfungibleHandle::cast,55 NonfungibleHandle::cast,
56 )56 )
57}57}
99 sender: cross_from_sub(owner); burner: cross_sub;99 sender: cross_from_sub(owner); burner: cross_sub;
100 };100 };
101 let item = create_max_item(&collection, &sender, burner.clone())?;101 let item = create_max_item(&collection, &sender, burner.clone())?;
102 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)}102 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}
103103
104 burn_recursively_breadth_plus_self_plus_self_per_each_raw {104 burn_recursively_breadth_plus_self_plus_self_per_each_raw {
105 let b in 0..200;105 let b in 0..200;
111 for i in 0..b {111 for i in 0..b {
112 create_max_item(&collection, &sender, T::CrossTokenAddressMapping::token_to_address(collection.id, item))?;112 create_max_item(&collection, &sender, T::CrossTokenAddressMapping::token_to_address(collection.id, item))?;
113 }113 }
114 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)}114 }: {<Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?}
115115
116 transfer {116 transfer {
117 bench_init!{117 bench_init!{
183 value: property_value(),183 value: property_value(),
184 }).collect::<Vec<_>>();184 }).collect::<Vec<_>>();
185 let item = create_max_item(&collection, &owner, owner.clone())?;185 let item = create_max_item(&collection, &owner, owner.clone())?;
186 }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props)?}186 }: {<Pallet<T>>::set_token_properties(&collection, &owner, item, props, false)?}
187187
188 delete_token_properties {188 delete_token_properties {
189 let b in 0..MAX_PROPERTIES_PER_ITEM;189 let b in 0..MAX_PROPERTIES_PER_ITEM;
205 value: property_value(),205 value: property_value(),
206 }).collect::<Vec<_>>();206 }).collect::<Vec<_>>();
207 let item = create_max_item(&collection, &owner, owner.clone())?;207 let item = create_max_item(&collection, &owner, owner.clone())?;
208 <Pallet<T>>::set_token_properties(&collection, &owner, item, props)?;208 <Pallet<T>>::set_token_properties(&collection, &owner, item, props, false)?;
209 let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();209 let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();
210 }: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete)?}210 }: {<Pallet<T>>::delete_token_properties(&collection, &owner, item, to_delete)?}
211}211}
addedpallets/proxy-rmrk-core/src/benchmarking.rsdiffbeforeafterboth

no changes

modifiedpallets/proxy-rmrk-core/src/lib.rsdiffbeforeafterboth
3131
32pub use pallet::*;32pub use pallet::*;
3333
34#[cfg(feature = "runtime-benchmarks")]
35pub mod benchmarking;
34pub mod misc;36pub mod misc;
35pub mod property;37pub mod property;
3638pub mod weights;
39
40pub type SelfWeightOf<T> = <T as Config>::WeightInfo;
41
42use weights::WeightInfo;
37use misc::*;43use misc::*;
38pub use property::*;44pub use property::*;
3945
51 frame_system::Config + pallet_common::Config + pallet_nonfungible::Config + account::Config57 frame_system::Config + pallet_common::Config + pallet_nonfungible::Config + account::Config
52 {58 {
53 type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;59 type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
60 type WeightInfo: WeightInfo;
54 }61 }
5562
56 #[pallet::storage]63 #[pallet::storage]
169176
170 #[pallet::call]177 #[pallet::call]
171 impl<T: Config> Pallet<T> {178 impl<T: Config> Pallet<T> {
172 #[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]179 #[pallet::weight(<SelfWeightOf<T>>::create_collection())]
173 #[transactional]180 #[transactional]
174 pub fn create_collection(181 pub fn create_collection(
175 origin: OriginFor<T>,182 origin: OriginFor<T>,
addedpallets/proxy-rmrk-core/src/weights.rsdiffbeforeafterboth

no changes

modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
827 list_benchmark!(list, extra, pallet_fungible, Fungible);827 list_benchmark!(list, extra, pallet_fungible, Fungible);
828 list_benchmark!(list, extra, pallet_refungible, Refungible);828 list_benchmark!(list, extra, pallet_refungible, Refungible);
829 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);829 list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
830 list_benchmark!(list, extra, pallet_proxy_rmrk_core, RmrkCore);
830 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);831 // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
831832
832 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();833 let storage_info = AllPalletsReversedWithSystemFirst::storage_info();
870 add_benchmark!(params, batches, pallet_fungible, Fungible);871 add_benchmark!(params, batches, pallet_fungible, Fungible);
871 add_benchmark!(params, batches, pallet_refungible, Refungible);872 add_benchmark!(params, batches, pallet_refungible, Refungible);
872 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);873 add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
874 add_benchmark!(params, batches, pallet_proxy_rmrk_core, RmrkCore);
873 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);875 // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
874876
875 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }877 if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
919}919}
920920
921impl pallet_proxy_rmrk_core::Config for Runtime {921impl pallet_proxy_rmrk_core::Config for Runtime {
922 type WeightInfo = pallet_proxy_rmrk_core::weights::SubstrateWeight<Self>;
922 type Event = Event;923 type Event = Event;
923}924}
924925
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
918}918}
919919
920impl pallet_proxy_rmrk_core::Config for Runtime {920impl pallet_proxy_rmrk_core::Config for Runtime {
921 type WeightInfo = pallet_proxy_rmrk_core::weights::SubstrateWeight<Self>;
921 type Event = Event;922 type Event = Event;
922}923}
923924
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
917}917}
918918
919impl pallet_proxy_rmrk_core::Config for Runtime {919impl pallet_proxy_rmrk_core::Config for Runtime {
920 type WeightInfo = pallet_proxy_rmrk_core::weights::SubstrateWeight<Self>;
920 type Event = Event;921 type Event = Event;
921}922}
922923