diff --git a/pallets/gear/src/benchmarking/code.rs b/pallets/gear/src/benchmarking/code.rs index 9ff8800d889..d047c92c69c 100644 --- a/pallets/gear/src/benchmarking/code.rs +++ b/pallets/gear/src/benchmarking/code.rs @@ -40,7 +40,8 @@ use gear_wasm_instrument::{ parity_wasm::{ builder, elements::{ - self, BlockType, CustomSection, FuncBody, Instruction, Instructions, Section, ValueType, + self, BlockType, CustomSection, FuncBody, FunctionType, Instruction, Instructions, + Section, Type, ValueType, }, }, syscalls::SyscallName, @@ -69,6 +70,8 @@ pub struct ModuleDefinition { pub data_segments: Vec, /// Creates the supplied amount of i64 mutable globals initialized with random values. pub num_globals: u32, + /// Make i64 globals init expr occupy 9 bytes. + pub full_length_globals: bool, /// List of syscalls that the module should import. They start with index 0. pub imported_functions: Vec, /// Function body of the exported `init` function. Body is empty if `None`. @@ -90,6 +93,8 @@ pub struct ModuleDefinition { pub aux_res: Option, /// Create a table containing function pointers. pub table: Option, + /// Create a type section with the specified amount of types. + pub types: Option, /// Create a section named "dummy" of the specified size. This is useful in order to /// benchmark the overhead of loading and storing codes of specified sizes. The dummy /// section only contributes to the size of the program but does not affect execution. @@ -106,6 +111,10 @@ pub struct TableSegment { pub function_index: u32, } +pub struct TypeSegment { + pub num_elements: u32, +} + pub struct DataSegment { pub offset: u32, pub value: Vec, @@ -261,7 +270,11 @@ where if def.num_globals > 0 { use rand::{distributions::Standard, prelude::*}; let rng = rand_pcg::Pcg32::seed_from_u64(3112244599778833558); - for val in rng.sample_iter(Standard).take(def.num_globals as usize) { + for mut val in rng.sample_iter(Standard).take(def.num_globals as usize) { + // Make i64 const init expr use full length + if def.full_length_globals { + val |= 1 << 63; + } program = program .global() .value_type() @@ -315,7 +328,24 @@ where ))); } - let code = program.build(); + let mut code = program.build(); + + // Add dummy type section + if let Some(types) = def.types { + for section in code.sections_mut() { + if let Section::Type(sec) = section { + for _ in 0..types.num_elements { + sec.types_mut().push(Type::Function(FunctionType::new( + vec![ValueType::I64; 6], + vec![ValueType::I64; 1], + ))); + } + // Add the types only to the first type section + break; + } + } + } + let code = code.into_bytes().unwrap(); let hash = CodeId::generate(&code); Self { @@ -378,6 +408,92 @@ where module.into() } + /// Creates a WebAssembly module with a data section of size `data_section_bytes`. + /// The generated module contains `data_segment_num` data segments with an overall size of `data_section_bytes`. + /// If `data_segment_num` is 0, no data segments are added. + /// If the result of dividing `data_section_bytes` by `data_segment_num` is 0, zero-length data segments are added. + pub fn sized_data_section(data_section_bytes: u32, data_segment_num: u32) -> Self { + let mut module = ModuleDefinition { + memory: Some(ImportedMemory::max::()), + ..Default::default() + }; + + if data_segment_num != 0 { + let (data_segment_size, residual_bytes) = ( + data_section_bytes / data_segment_num, + data_section_bytes % data_segment_num, + ); + + for seg_idx in 0..data_segment_num { + module.data_segments.push(DataSegment { + offset: seg_idx * data_segment_size, + value: vec![0xA5; data_segment_size as usize], + }); + } + + // Add residual bytes to the last data segment + if residual_bytes != 0 { + if let Some(last) = module.data_segments.last_mut() { + last.value + .resize(data_segment_size as usize + residual_bytes as usize, 0xA5) + } + } + } + + module.into() + } + + /// Creates a wasm module of `target_bytes` size. + /// The generated module generates wasm module containing only global section. + pub fn sized_global_section(target_bytes: u32) -> Self { + let mut module = ModuleDefinition { + memory: Some(ImportedMemory::max::()), + ..Default::default() + }; + + // Maximum size of encoded i64 global is 14 bytes. + module.num_globals = target_bytes / 14; + module.full_length_globals = true; + + module.into() + } + + /// Creates a WebAssembly module with a table size of `target_bytes` bytes. + /// Each element in the table points to function index `0` and occupies 1 byte. + pub fn sized_table_section(target_bytes: u32) -> Self { + let mut module = ModuleDefinition { + memory: Some(ImportedMemory::max::()), + ..Default::default() + }; + + module.init_body = Some(body::empty()); + + // 1 element with function index value `0` takes 1 byte to encode. + let num_elements = target_bytes; + + module.table = Some(TableSegment { + num_elements, + function_index: 0, + }); + + module.into() + } + + /// Creates a WebAssembly module with a type section of size `target_bytes` bytes. + pub fn sized_type_section(target_bytes: u32) -> Self { + let mut module = ModuleDefinition { + memory: Some(ImportedMemory::max::()), + ..Default::default() + }; + + // Dummy type section takes 10 bytes. + module.types = Some(TypeSegment { + num_elements: target_bytes / 10, + }); + + module.into() + } + /// Creates a memory instance for use in a sandbox with dimensions declared in this module /// and adds it to `env`. A reference to that memory is returned so that it can be used to /// access the memory contents from the supervisor. diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 9f8895988dd..0bf021a1158 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -115,6 +115,7 @@ const MAX_PAYLOAD_LEN: u32 = 32 * 64 * 1024; const MAX_PAYLOAD_LEN_KB: u32 = MAX_PAYLOAD_LEN / 1024; const MAX_PAGES: u32 = 512; const MAX_SALT_SIZE_BYTES: u32 = 4 * 1024 * 1024; +const MAX_NUMBER_OF_DATA_SEGMENTS: u32 = 1024; /// How many batches we do per API benchmark. const API_BENCHMARK_BATCHES: u32 = 20; @@ -374,13 +375,53 @@ benchmarks! { BenchmarkStorage::::get(c).expect("Infallible: Key not found in storage"); } - // `c`: Size of the code in kilobytes. - instantiate_module_per_kb { + // `c`: Size of the code section in kilobytes. + instantiate_module_code_section_per_kb { let c in 0 .. T::Schedule::get().limits.code_len / 1024; let WasmModule { code, .. } = WasmModule::::sized(c * 1024, Location::Init); + let ext = Externalities::new(ProcessorContext::new_mock()); }: { + Environment::new(ext, &code, DispatchKind::Init, Default::default(), max_pages::().into()).unwrap(); + } + + // `d`: Size of the data section in kilobytes. + instantiate_module_data_section_per_kb { + let d in 0 .. T::Schedule::get().limits.code_len / 1024; + + let WasmModule { code, .. } = WasmModule::::sized_data_section(d * 1024, MAX_NUMBER_OF_DATA_SEGMENTS); let ext = Externalities::new(ProcessorContext::new_mock()); + }: { + Environment::new(ext, &code, DispatchKind::Init, Default::default(), max_pages::().into()).unwrap(); + } + + // `g`: Size of the global section in kilobytes. + instantiate_module_global_section_per_kb { + let g in 0 .. T::Schedule::get().limits.code_len / 1024; + + let WasmModule { code, .. } = WasmModule::::sized_global_section(g * 1024); + let ext = Externalities::new(ProcessorContext::new_mock()); + }: { + Environment::new(ext, &code, DispatchKind::Init, Default::default(), max_pages::().into()).unwrap(); + } + + // `t`: Size of the table section in kilobytes. + instantiate_module_table_section_per_kb { + let t in 0 .. T::Schedule::get().limits.code_len / 1024; + + let WasmModule { code, .. } = WasmModule::::sized_table_section(t * 1024); + let ext = Externalities::new(ProcessorContext::new_mock()); + }: { + Environment::new(ext, &code, DispatchKind::Init, Default::default(), max_pages::().into()).unwrap(); + } + + // `t`: Size of the type section in kilobytes. + instantiate_module_type_section_per_kb { + let t in 0 .. T::Schedule::get().limits.code_len / 1024; + + let WasmModule { code, .. } = WasmModule::::sized_type_section(t * 1024); + let ext = Externalities::new(ProcessorContext::new_mock()); + }: { Environment::new(ext, &code, DispatchKind::Init, Default::default(), max_pages::().into()).unwrap(); } diff --git a/pallets/gear/src/schedule.rs b/pallets/gear/src/schedule.rs index f9d1e63c9e5..e52ecb2c199 100644 --- a/pallets/gear/src/schedule.rs +++ b/pallets/gear/src/schedule.rs @@ -763,7 +763,9 @@ impl Default for Schedule { memory_weights: Default::default(), db_write_per_byte: to_weight!(cost_byte!(db_write_per_kb)), db_read_per_byte: to_weight!(cost_byte!(db_read_per_kb)), - module_instantiation_per_byte: to_weight!(cost_byte!(instantiate_module_per_kb)), + module_instantiation_per_byte: to_weight!(cost_byte!( + instantiate_module_code_section_per_kb + )), code_instrumentation_cost: call_zero!(reinstrument_per_kb, 0), code_instrumentation_byte_cost: to_weight!(cost_byte!(reinstrument_per_kb)), } diff --git a/pallets/gear/src/weights.rs b/pallets/gear/src/weights.rs index 688ffcef9d1..ad392a03947 100644 --- a/pallets/gear/src/weights.rs +++ b/pallets/gear/src/weights.rs @@ -23,6 +23,13 @@ //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 +//! +//! MANUAL UPDATES FOR 2024-05-10: +//! Rename weight: instantiate_module_code_section_per_kb +//! Append new weight: instantiate_module_data_section_per_kb +//! Append new weight: instantiate_module_global_section_per_kb +//! Append new weight: instantiate_module_table_section_per_kb +//! Append new weight: instantiate_module_type_section_per_kb // Executed Command: // ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_gear --extrinsic=alloc,alloc_per_page,claim_value,create_program,db_read_per_kb,db_write_per_kb,free,free_range,free_range_per_page,gr_block_height,gr_block_timestamp,gr_create_program,gr_create_program_per_kb,gr_create_program_wgas,gr_create_program_wgas_per_kb,gr_debug,gr_debug_per_kb,gr_env_vars,gr_gas_available,gr_message_id,gr_program_id,gr_random,gr_read,gr_read_per_kb,gr_reply_code,gr_reply_deposit,gr_reply_per_kb,gr_reply_push,gr_reply_push_input,gr_reply_push_input_per_kb,gr_reply_push_per_kb,gr_reply_to,gr_reply_wgas_per_kb,gr_reservation_reply_commit_per_kb,gr_reservation_reply_per_kb,gr_reservation_send,gr_reservation_send_commit,gr_reservation_send_per_kb,gr_reserve_gas,gr_send,gr_send_commit,gr_send_commit_wgas,gr_send_init,gr_send_input,gr_send_input_wgas,gr_send_per_kb,gr_send_push,gr_send_push_input,gr_send_push_input_per_kb,gr_send_push_per_kb,gr_send_wgas,gr_send_wgas_per_kb,gr_signal_code,gr_signal_from,gr_size,gr_source,gr_system_reserve_gas,gr_unreserve_gas,gr_value,gr_value_available,gr_wake,instantiate_module_per_kb,instr_br,instr_br_if,instr_br_table,instr_br_table_per_entry,instr_call,instr_call_const,instr_call_indirect,instr_call_indirect_per_param,instr_call_per_local,instr_global_get,instr_global_set,instr_i32add,instr_i32and,instr_i32clz,instr_i32ctz,instr_i32divs,instr_i32divu,instr_i32eq,instr_i32eqz,instr_i32extend16s,instr_i32extend8s,instr_i32ges,instr_i32geu,instr_i32gts,instr_i32gtu,instr_i32les,instr_i32leu,instr_i32load,instr_i32lts,instr_i32ltu,instr_i32mul,instr_i32ne,instr_i32or,instr_i32popcnt,instr_i32rems,instr_i32remu,instr_i32rotl,instr_i32rotr,instr_i32shl,instr_i32shrs,instr_i32shru,instr_i32store,instr_i32sub,instr_i32wrapi64,instr_i32xor,instr_i64add,instr_i64and,instr_i64clz,instr_i64ctz,instr_i64divs,instr_i64divu,instr_i64eq,instr_i64eqz,instr_i64extend16s,instr_i64extend32s,instr_i64extend8s,instr_i64extendsi32,instr_i64extendui32,instr_i64ges,instr_i64geu,instr_i64gts,instr_i64gtu,instr_i64les,instr_i64leu,instr_i64load,instr_i64lts,instr_i64ltu,instr_i64mul,instr_i64ne,instr_i64or,instr_i64popcnt,instr_i64rems,instr_i64remu,instr_i64rotl,instr_i64rotr,instr_i64shl,instr_i64shrs,instr_i64shru,instr_i64store,instr_i64sub,instr_i64xor,instr_if,instr_local_get,instr_local_set,instr_local_tee,instr_memory_current,instr_select,lazy_pages_host_func_read,lazy_pages_host_func_write,lazy_pages_host_func_write_after_read,lazy_pages_load_page_storage_data,lazy_pages_signal_read,lazy_pages_signal_write,lazy_pages_signal_write_after_read,mem_grow,reinstrument_per_kb,send_message,send_reply,tasks_remove_from_mailbox,tasks_remove_from_waitlist,tasks_remove_gas_reservation,tasks_send_dispatch,tasks_send_user_message,tasks_send_user_message_to_mailbox,tasks_wake_message,tasks_wake_message_no_wake,upload_code,upload_program --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_gear.rs --template=.maintain/frame-weight-template.hbs @@ -52,7 +59,11 @@ pub trait WeightInfo { fn gr_wait_up_to(r: u32, ) -> Weight; fn db_write_per_kb(c: u32, ) -> Weight; fn db_read_per_kb(c: u32, ) -> Weight; - fn instantiate_module_per_kb(c: u32, ) -> Weight; + fn instantiate_module_code_section_per_kb(c: u32, ) -> Weight; + fn instantiate_module_data_section_per_kb(d: u32, ) -> Weight; + fn instantiate_module_global_section_per_kb(g: u32, ) -> Weight; + fn instantiate_module_table_section_per_kb(t: u32, ) -> Weight; + fn instantiate_module_type_section_per_kb(t: u32, ) -> Weight; fn claim_value() -> Weight; fn upload_code(c: u32, ) -> Weight; fn create_program(s: u32, ) -> Weight; @@ -380,7 +391,7 @@ impl WeightInfo for SubstrateWeight { .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } /// The range of component `c` is `[0, 512]`. - fn instantiate_module_per_kb(c: u32, ) -> Weight { + fn instantiate_module_code_section_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` @@ -389,6 +400,46 @@ impl WeightInfo for SubstrateWeight { // Standard Error: 2_541 .saturating_add(Weight::from_parts(262_101, 0).saturating_mul(c.into())) } + /// The range of component `d` is `[0, 512]`. + fn instantiate_module_data_section_per_kb(d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 46_271_000 picoseconds. + Weight::from_parts(51_160_836, 0) + // Standard Error: 2_953 + .saturating_add(Weight::from_parts(537_213, 0).saturating_mul(d.into())) + } + /// The range of component `g` is `[0, 512]`. + fn instantiate_module_global_section_per_kb(g: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 35_857_000 picoseconds. + Weight::from_parts(3_781_493, 0) + // Standard Error: 7_646 + .saturating_add(Weight::from_parts(2_815_972, 0).saturating_mul(g.into())) + } + /// The range of component `t` is `[0, 512]`. + fn instantiate_module_table_section_per_kb(t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 36_788_000 picoseconds. + Weight::from_parts(38_141_151, 0) + // Standard Error: 3_777 + .saturating_add(Weight::from_parts(18_936_755, 0).saturating_mul(t.into())) + } + /// The range of component `t` is `[0, 512]`. + fn instantiate_module_type_section_per_kb(t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 36_032_000 picoseconds. + Weight::from_parts(31_520_091, 0) + // Standard Error: 3_800 + .saturating_add(Weight::from_parts(372_820, 0).saturating_mul(t.into())) + } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1321` @@ -2244,7 +2295,7 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } /// The range of component `c` is `[0, 512]`. - fn instantiate_module_per_kb(c: u32, ) -> Weight { + fn instantiate_module_code_section_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` @@ -2253,6 +2304,48 @@ impl WeightInfo for () { // Standard Error: 2_541 .saturating_add(Weight::from_parts(262_101, 0).saturating_mul(c.into())) } + + /// The range of component `d` is `[0, 512]`. + fn instantiate_module_data_section_per_kb(d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 46_271_000 picoseconds. + Weight::from_parts(51_160_836, 0) + // Standard Error: 2_953 + .saturating_add(Weight::from_parts(537_213, 0).saturating_mul(d.into())) + } + /// The range of component `g` is `[0, 512]`. + fn instantiate_module_global_section_per_kb(g: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 35_857_000 picoseconds. + Weight::from_parts(3_781_493, 0) + // Standard Error: 7_646 + .saturating_add(Weight::from_parts(2_815_972, 0).saturating_mul(g.into())) + } + /// The range of component `t` is `[0, 512]`. + fn instantiate_module_table_section_per_kb(t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 36_788_000 picoseconds. + Weight::from_parts(38_141_151, 0) + // Standard Error: 3_777 + .saturating_add(Weight::from_parts(18_936_755, 0).saturating_mul(t.into())) + } + /// The range of component `t` is `[0, 512]`. + fn instantiate_module_type_section_per_kb(t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 36_032_000 picoseconds. + Weight::from_parts(31_520_091, 0) + // Standard Error: 3_800 + .saturating_add(Weight::from_parts(372_820, 0).saturating_mul(t.into())) + } + fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1321` diff --git a/runtime/vara/src/weights/pallet_gear.rs b/runtime/vara/src/weights/pallet_gear.rs index 2c9e8b46335..bd0aea0f1e4 100644 --- a/runtime/vara/src/weights/pallet_gear.rs +++ b/runtime/vara/src/weights/pallet_gear.rs @@ -23,6 +23,13 @@ //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 +//! +//! MANUAL UPDATES FOR 2024-05-10: +//! Rename weight: instantiate_module_code_section_per_kb +//! Append new weight: instantiate_module_data_section_per_kb +//! Append new weight: instantiate_module_global_section_per_kb +//! Append new weight: instantiate_module_table_section_per_kb +//! Append new weight: instantiate_module_type_section_per_kb // Executed Command: // ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_gear --extrinsic=alloc,alloc_per_page,claim_value,create_program,db_read_per_kb,db_write_per_kb,free,free_range,free_range_per_page,gr_block_height,gr_block_timestamp,gr_create_program,gr_create_program_per_kb,gr_create_program_wgas,gr_create_program_wgas_per_kb,gr_debug,gr_debug_per_kb,gr_env_vars,gr_gas_available,gr_message_id,gr_program_id,gr_random,gr_read,gr_read_per_kb,gr_reply_code,gr_reply_deposit,gr_reply_per_kb,gr_reply_push,gr_reply_push_input,gr_reply_push_input_per_kb,gr_reply_push_per_kb,gr_reply_to,gr_reply_wgas_per_kb,gr_reservation_reply_commit_per_kb,gr_reservation_reply_per_kb,gr_reservation_send,gr_reservation_send_commit,gr_reservation_send_per_kb,gr_reserve_gas,gr_send,gr_send_commit,gr_send_commit_wgas,gr_send_init,gr_send_input,gr_send_input_wgas,gr_send_per_kb,gr_send_push,gr_send_push_input,gr_send_push_input_per_kb,gr_send_push_per_kb,gr_send_wgas,gr_send_wgas_per_kb,gr_signal_code,gr_signal_from,gr_size,gr_source,gr_system_reserve_gas,gr_unreserve_gas,gr_value,gr_value_available,gr_wake,instantiate_module_per_kb,instr_br,instr_br_if,instr_br_table,instr_br_table_per_entry,instr_call,instr_call_const,instr_call_indirect,instr_call_indirect_per_param,instr_call_per_local,instr_global_get,instr_global_set,instr_i32add,instr_i32and,instr_i32clz,instr_i32ctz,instr_i32divs,instr_i32divu,instr_i32eq,instr_i32eqz,instr_i32extend16s,instr_i32extend8s,instr_i32ges,instr_i32geu,instr_i32gts,instr_i32gtu,instr_i32les,instr_i32leu,instr_i32load,instr_i32lts,instr_i32ltu,instr_i32mul,instr_i32ne,instr_i32or,instr_i32popcnt,instr_i32rems,instr_i32remu,instr_i32rotl,instr_i32rotr,instr_i32shl,instr_i32shrs,instr_i32shru,instr_i32store,instr_i32sub,instr_i32wrapi64,instr_i32xor,instr_i64add,instr_i64and,instr_i64clz,instr_i64ctz,instr_i64divs,instr_i64divu,instr_i64eq,instr_i64eqz,instr_i64extend16s,instr_i64extend32s,instr_i64extend8s,instr_i64extendsi32,instr_i64extendui32,instr_i64ges,instr_i64geu,instr_i64gts,instr_i64gtu,instr_i64les,instr_i64leu,instr_i64load,instr_i64lts,instr_i64ltu,instr_i64mul,instr_i64ne,instr_i64or,instr_i64popcnt,instr_i64rems,instr_i64remu,instr_i64rotl,instr_i64rotr,instr_i64shl,instr_i64shrs,instr_i64shru,instr_i64store,instr_i64sub,instr_i64xor,instr_if,instr_local_get,instr_local_set,instr_local_tee,instr_memory_current,instr_select,lazy_pages_host_func_read,lazy_pages_host_func_write,lazy_pages_host_func_write_after_read,lazy_pages_load_page_storage_data,lazy_pages_signal_read,lazy_pages_signal_write,lazy_pages_signal_write_after_read,mem_grow,reinstrument_per_kb,send_message,send_reply,tasks_remove_from_mailbox,tasks_remove_from_waitlist,tasks_remove_gas_reservation,tasks_send_dispatch,tasks_send_user_message,tasks_send_user_message_to_mailbox,tasks_wake_message,tasks_wake_message_no_wake,upload_code,upload_program --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_gear.rs --template=.maintain/frame-weight-template.hbs @@ -52,7 +59,11 @@ pub trait WeightInfo { fn gr_wait_up_to(r: u32, ) -> Weight; fn db_write_per_kb(c: u32, ) -> Weight; fn db_read_per_kb(c: u32, ) -> Weight; - fn instantiate_module_per_kb(c: u32, ) -> Weight; + fn instantiate_module_code_section_per_kb(c: u32, ) -> Weight; + fn instantiate_module_data_section_per_kb(d: u32, ) -> Weight; + fn instantiate_module_global_section_per_kb(g: u32, ) -> Weight; + fn instantiate_module_table_section_per_kb(t: u32, ) -> Weight; + fn instantiate_module_type_section_per_kb(t: u32, ) -> Weight; fn claim_value() -> Weight; fn upload_code(c: u32, ) -> Weight; fn create_program(s: u32, ) -> Weight; @@ -380,7 +391,7 @@ impl pallet_gear::WeightInfo for SubstrateWeight { .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } /// The range of component `c` is `[0, 512]`. - fn instantiate_module_per_kb(c: u32, ) -> Weight { + fn instantiate_module_code_section_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` @@ -389,6 +400,46 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Standard Error: 2_541 .saturating_add(Weight::from_parts(262_101, 0).saturating_mul(c.into())) } + /// The range of component `d` is `[0, 512]`. + fn instantiate_module_data_section_per_kb(d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 46_271_000 picoseconds. + Weight::from_parts(51_160_836, 0) + // Standard Error: 2_953 + .saturating_add(Weight::from_parts(537_213, 0).saturating_mul(d.into())) + } + /// The range of component `g` is `[0, 512]`. + fn instantiate_module_global_section_per_kb(g: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 35_857_000 picoseconds. + Weight::from_parts(3_781_493, 0) + // Standard Error: 7_646 + .saturating_add(Weight::from_parts(2_815_972, 0).saturating_mul(g.into())) + } + /// The range of component `t` is `[0, 512]`. + fn instantiate_module_table_section_per_kb(t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 36_788_000 picoseconds. + Weight::from_parts(38_141_151, 0) + // Standard Error: 3_777 + .saturating_add(Weight::from_parts(18_936_755, 0).saturating_mul(t.into())) + } + /// The range of component `t` is `[0, 512]`. + fn instantiate_module_type_section_per_kb(t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 36_032_000 picoseconds. + Weight::from_parts(31_520_091, 0) + // Standard Error: 3_800 + .saturating_add(Weight::from_parts(372_820, 0).saturating_mul(t.into())) + } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1321` @@ -2244,7 +2295,7 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } /// The range of component `c` is `[0, 512]`. - fn instantiate_module_per_kb(c: u32, ) -> Weight { + fn instantiate_module_code_section_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` @@ -2253,6 +2304,48 @@ impl WeightInfo for () { // Standard Error: 2_541 .saturating_add(Weight::from_parts(262_101, 0).saturating_mul(c.into())) } + + /// The range of component `d` is `[0, 512]`. + fn instantiate_module_data_section_per_kb(d: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 46_271_000 picoseconds. + Weight::from_parts(51_160_836, 0) + // Standard Error: 2_953 + .saturating_add(Weight::from_parts(537_213, 0).saturating_mul(d.into())) + } + /// The range of component `g` is `[0, 512]`. + fn instantiate_module_global_section_per_kb(g: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 35_857_000 picoseconds. + Weight::from_parts(3_781_493, 0) + // Standard Error: 7_646 + .saturating_add(Weight::from_parts(2_815_972, 0).saturating_mul(g.into())) + } + /// The range of component `t` is `[0, 512]`. + fn instantiate_module_table_section_per_kb(t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 36_788_000 picoseconds. + Weight::from_parts(38_141_151, 0) + // Standard Error: 3_777 + .saturating_add(Weight::from_parts(18_936_755, 0).saturating_mul(t.into())) + } + /// The range of component `t` is `[0, 512]`. + fn instantiate_module_type_section_per_kb(t: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 36_032_000 picoseconds. + Weight::from_parts(31_520_091, 0) + // Standard Error: 3_800 + .saturating_add(Weight::from_parts(372_820, 0).saturating_mul(t.into())) + } + fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1321`