mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 18:27:56 +00:00
New weights using i7 machine (#5848)
* i7 weights * fix full block test * fix merge * fix priority
This commit is contained in:
@@ -130,8 +130,8 @@ parameter_types! {
|
||||
/// This probably should not be changed unless you have specific
|
||||
/// disk i/o conditions for the node.
|
||||
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 60_000_000, // ~0.06 ms = ~60 µs
|
||||
write: 200_000_000, // ~0.2 ms = 200 µs
|
||||
read: 25_000_000, // ~25 µs
|
||||
write: 100_000_000, // ~100 µs
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -339,7 +339,7 @@ fn full_native_block_import_works() {
|
||||
phase: Phase::ApplyExtrinsic(0),
|
||||
// timestamp set call with weight 9_000_000 + 2 read + 1 write
|
||||
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
|
||||
DispatchInfo { weight: 9_000_000 + 2 * 60_000_000 + 1 * 200_000_000, class: DispatchClass::Mandatory, ..Default::default() }
|
||||
DispatchInfo { weight: 9_000_000 + 2 * 25_000_000 + 1 * 100_000_000, class: DispatchClass::Mandatory, ..Default::default() }
|
||||
)),
|
||||
topics: vec![],
|
||||
},
|
||||
@@ -359,8 +359,9 @@ fn full_native_block_import_works() {
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
// Balance Transfer 80_000_000 + 1 Read + 1 Write
|
||||
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
|
||||
DispatchInfo { weight: 460_000_000, ..Default::default() }
|
||||
DispatchInfo { weight: 80_000_000 + 25_000_000 + 100_000_000, ..Default::default() }
|
||||
)),
|
||||
topics: vec![],
|
||||
},
|
||||
@@ -393,7 +394,7 @@ fn full_native_block_import_works() {
|
||||
phase: Phase::ApplyExtrinsic(0),
|
||||
// timestamp set call with weight 9_000_000 + 2 read + 1 write
|
||||
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
|
||||
DispatchInfo { weight: 9_000_000 + 2 * 60_000_000 + 1 * 200_000_000, class: DispatchClass::Mandatory, ..Default::default() }
|
||||
DispatchInfo { weight: 9_000_000 + 2 * 25_000_000 + 1 * 100_000_000, class: DispatchClass::Mandatory, ..Default::default() }
|
||||
)),
|
||||
topics: vec![],
|
||||
},
|
||||
@@ -415,8 +416,9 @@ fn full_native_block_import_works() {
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(1),
|
||||
// Balance Transfer 80_000_000 + 1 Read + 1 Write
|
||||
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
|
||||
DispatchInfo { weight: 460_000_000, ..Default::default() }
|
||||
DispatchInfo { weight: 80_000_000 + 25_000_000 + 100_000_000, ..Default::default() }
|
||||
)),
|
||||
topics: vec![],
|
||||
},
|
||||
@@ -438,8 +440,9 @@ fn full_native_block_import_works() {
|
||||
},
|
||||
EventRecord {
|
||||
phase: Phase::ApplyExtrinsic(2),
|
||||
// Balance Transfer 80_000_000 + 1 Read + 1 Write
|
||||
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess(
|
||||
DispatchInfo { weight: 460_000_000, ..Default::default() }
|
||||
DispatchInfo { weight: 80_000_000 + 25_000_000 + 100_000_000, ..Default::default() }
|
||||
)),
|
||||
topics: vec![],
|
||||
},
|
||||
|
||||
@@ -230,7 +230,7 @@ fn submitted_transaction_should_be_valid() {
|
||||
let res = Executive::validate_transaction(source, extrinsic);
|
||||
|
||||
assert_eq!(res.unwrap(), ValidTransaction {
|
||||
priority: 1_411_390_000_000,
|
||||
priority: 1_410_625_000_000,
|
||||
requires: vec![],
|
||||
provides: vec![(address, 0).encode()],
|
||||
longevity: 128,
|
||||
|
||||
@@ -124,8 +124,8 @@ parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 60_000_000, // ~0.06 ms = ~60 µs
|
||||
write: 200_000_000, // ~0.2 ms = 200 µs
|
||||
read: 25_000_000, // ~25 µs
|
||||
write: 100_000_000, // ~100 µs
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -431,9 +431,12 @@ decl_module! {
|
||||
/// - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.
|
||||
/// - `transfer_keep_alive` works the same way as `transfer`, but has an additional
|
||||
/// check that the transfer will not kill the origin account.
|
||||
///
|
||||
/// ---------------------------------
|
||||
/// - Base Weight: 80 µs, worst case scenario (account created, account removed)
|
||||
/// - DB Weight: 1 Read and 1 Write to destination account
|
||||
/// - Origin account is already in memory, so no DB operations for them.
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 200_000_000]
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 80_000_000]
|
||||
pub fn transfer(
|
||||
origin,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -456,8 +459,11 @@ decl_module! {
|
||||
/// # <weight>
|
||||
/// - Independent of the arguments.
|
||||
/// - Contains a limited number of reads and writes.
|
||||
/// ---------------------
|
||||
/// - Base Weight: 32.6 µs
|
||||
/// - DB Weight: 1 Read, 1 Write to `who`
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 100_000_000]
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 35_000_000]
|
||||
fn set_balance(
|
||||
origin,
|
||||
who: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -499,7 +505,7 @@ decl_module! {
|
||||
/// - Same as transfer, but additional read and write because the source account is
|
||||
/// not assumed to be in the overlay.
|
||||
/// # </weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(2, 2) + 200_000_000]
|
||||
#[weight = T::DbWeight::get().reads_writes(2, 2) + 80_000_000]
|
||||
pub fn force_transfer(
|
||||
origin,
|
||||
source: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -518,7 +524,12 @@ decl_module! {
|
||||
/// 99% of the time you want [`transfer`] instead.
|
||||
///
|
||||
/// [`transfer`]: struct.Module.html#method.transfer
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 150_000_000]
|
||||
/// # <weight>
|
||||
/// - Cheaper than transfer because account cannot be killed.
|
||||
/// - Base Weight: 57.36 µs
|
||||
/// - DB Weight: 1 Read and 1 Write to dest (sender is in overlay already)
|
||||
/// #</weight>
|
||||
#[weight = T::DbWeight::get().reads_writes(1, 1) + 60_000_000]
|
||||
pub fn transfer_keep_alive(
|
||||
origin,
|
||||
dest: <T::Lookup as StaticLookup>::Source,
|
||||
|
||||
@@ -205,17 +205,17 @@ mod weight_of {
|
||||
use super::*;
|
||||
|
||||
/// - Base Weight:
|
||||
/// - Create: 137.5 + 0.274 * S µs
|
||||
/// - Approve: 103.8 + .266 * S µs
|
||||
/// - Complete: 116.2 + .754 * S µs
|
||||
/// - Create: 59.2 + 0.096 * S µs
|
||||
/// - Approve: 42.27 + .116 * S µs
|
||||
/// - Complete: 50.91 + .232 * S µs
|
||||
/// - DB Weight:
|
||||
/// - Reads: Multisig Storage, [Caller Account]
|
||||
/// - Writes: Multisig Storage, [Caller Account]
|
||||
/// - Plus Call Weight
|
||||
pub fn as_multi<T: Trait>(other_sig_len: usize, call_weight: Weight) -> Weight {
|
||||
call_weight
|
||||
.saturating_add(150_000_000)
|
||||
.saturating_add((other_sig_len as Weight).saturating_mul(750_000))
|
||||
.saturating_add(60_000_000)
|
||||
.saturating_add((other_sig_len as Weight).saturating_mul(250_000))
|
||||
.saturating_add(T::DbWeight::get().reads_writes(1, 1))
|
||||
}
|
||||
}
|
||||
@@ -236,7 +236,7 @@ decl_module! {
|
||||
/// - `calls`: The calls to be dispatched from the same origin.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Base weight: 63.78 µs
|
||||
/// - Base weight: 15.64 + .987 * c µs
|
||||
/// - Plus the sum of the weights of the `calls`.
|
||||
/// - Plus one additional event. (repeat read/write)
|
||||
/// # </weight>
|
||||
@@ -250,7 +250,7 @@ decl_module! {
|
||||
|args: (&Vec<<T as Trait>::Call>,)| {
|
||||
args.0.iter()
|
||||
.map(|call| call.get_dispatch_info().weight)
|
||||
.fold(65_000_000, |a: Weight, n| a.saturating_add(n))
|
||||
.fold(15_000_000, |a: Weight, n| a.saturating_add(n).saturating_add(1_000_000))
|
||||
},
|
||||
|args: (&Vec<<T as Trait>::Call>,)| {
|
||||
let all_operational = args.0.iter()
|
||||
@@ -280,12 +280,12 @@ decl_module! {
|
||||
/// The dispatch origin for this call must be _Signed_.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - Base weight: 5.1 µs
|
||||
/// - Base weight: 2.863 µs
|
||||
/// - Plus the weight of the `call`
|
||||
/// # </weight>
|
||||
#[weight = FunctionOf(
|
||||
|args: (&u16, &Box<<T as Trait>::Call>)| {
|
||||
args.1.get_dispatch_info().weight.saturating_add(5_000_000)
|
||||
args.1.get_dispatch_info().weight.saturating_add(3_000_000)
|
||||
},
|
||||
|args: (&u16, &Box<<T as Trait>::Call>)| args.1.get_dispatch_info().class,
|
||||
Pays::Yes,
|
||||
@@ -339,9 +339,9 @@ decl_module! {
|
||||
/// `MultisigDepositBase + threshold * MultisigDepositFactor`.
|
||||
/// -------------------------------
|
||||
/// - Base Weight:
|
||||
/// - Create: 137.5 + 0.274 * S µs
|
||||
/// - Approve: 103.8 + .266 * S µs
|
||||
/// - Complete: 116.2 + .754 * S µs
|
||||
/// - Create: 59.2 + 0.096 * S µs
|
||||
/// - Approve: 42.27 + .116 * S µs
|
||||
/// - Complete: 50.91 + .232 * S µs
|
||||
/// - DB Weight:
|
||||
/// - Reads: Multisig Storage, [Caller Account]
|
||||
/// - Writes: Multisig Storage, [Caller Account]
|
||||
@@ -471,8 +471,8 @@ decl_module! {
|
||||
/// `MultisigDepositBase + threshold * MultisigDepositFactor`.
|
||||
/// ----------------------------------
|
||||
/// - Base Weight:
|
||||
/// - Create: 139.1 + 0.202 * S
|
||||
/// - Approve: 96.6 + 0.328 * S
|
||||
/// - Create: 56.3 + 0.107 * S
|
||||
/// - Approve: 39.25 + 0.121 * S
|
||||
/// - DB Weight:
|
||||
/// - Read: Multisig Storage, [Caller Account]
|
||||
/// - Write: Multisig Storage, [Caller Account]
|
||||
@@ -480,8 +480,8 @@ decl_module! {
|
||||
#[weight = FunctionOf(
|
||||
|args: (&u16, &Vec<T::AccountId>, &Option<Timepoint<T::BlockNumber>>, &[u8; 32])| {
|
||||
T::DbWeight::get().reads_writes(1, 1)
|
||||
.saturating_add(140_000_000)
|
||||
.saturating_add((args.1.len() as Weight).saturating_mul(350_000))
|
||||
.saturating_add(60_000_000)
|
||||
.saturating_add((args.1.len() as Weight).saturating_mul(120_000))
|
||||
},
|
||||
DispatchClass::Normal,
|
||||
Pays::Yes,
|
||||
@@ -554,7 +554,7 @@ decl_module! {
|
||||
/// - I/O: 1 read `O(S)`, one remove.
|
||||
/// - Storage: removes one item.
|
||||
/// ----------------------------------
|
||||
/// - Base Weight: 126.6 + 0.126 * S
|
||||
/// - Base Weight: 46.71 + 0.09 * S
|
||||
/// - DB Weight:
|
||||
/// - Read: Multisig Storage, [Caller Account]
|
||||
/// - Write: Multisig Storage, [Caller Account]
|
||||
@@ -562,8 +562,8 @@ decl_module! {
|
||||
#[weight = FunctionOf(
|
||||
|args: (&u16, &Vec<T::AccountId>, &Timepoint<T::BlockNumber>, &[u8; 32])| {
|
||||
T::DbWeight::get().reads_writes(1, 1)
|
||||
.saturating_add(130_000_000)
|
||||
.saturating_add((args.1.len() as Weight).saturating_mul(130_000))
|
||||
.saturating_add(50_000_000)
|
||||
.saturating_add((args.1.len() as Weight).saturating_mul(100_000))
|
||||
},
|
||||
DispatchClass::Normal,
|
||||
Pays::Yes,
|
||||
|
||||
@@ -193,10 +193,12 @@ decl_module! {
|
||||
/// - DbWeight: 2 Reads, 2 Writes
|
||||
/// - Reads: Vesting Storage, Balances Locks, [Sender Account]
|
||||
/// - Writes: Vesting Storage, Balances Locks, [Sender Account]
|
||||
/// - Benchmark: 147.5 µs (min square analysis)
|
||||
/// - Assuming less than 50 locks on any user, else we may want factor in number of locks.
|
||||
/// - Benchmark:
|
||||
/// - Unlocked: 56.1 + .098 * l µs (min square analysis)
|
||||
/// - Locked: 54.37 + .254 * l µs (min square analysis)
|
||||
/// - Using 60 µs fixed. Assuming less than 50 locks on any user, else we may want factor in number of locks.
|
||||
/// # </weight>
|
||||
#[weight = 150_000_000 + T::DbWeight::get().reads_writes(2, 2)]
|
||||
#[weight = 60_000_000 + T::DbWeight::get().reads_writes(2, 2)]
|
||||
fn vest(origin) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
Self::update_lock(who)
|
||||
@@ -216,10 +218,12 @@ decl_module! {
|
||||
/// - DbWeight: 3 Reads, 3 Writes
|
||||
/// - Reads: Vesting Storage, Balances Locks, Target Account
|
||||
/// - Writes: Vesting Storage, Balances Locks, Target Account
|
||||
/// - Benchmark: 150.4 µs (min square analysis)
|
||||
/// - Assuming less than 50 locks on any user, else we may want factor in number of locks.
|
||||
/// - Benchmark:
|
||||
/// - Unlocked: 58.09 + .104 * l µs (min square analysis)
|
||||
/// - Locked: 55.35 + .255 * l µs (min square analysis)
|
||||
/// - Using 60 µs fixed. Assuming less than 50 locks on any user, else we may want factor in number of locks.
|
||||
/// # </weight>
|
||||
#[weight = 150_000_000 + T::DbWeight::get().reads_writes(3, 3)]
|
||||
#[weight = 60_000_000 + T::DbWeight::get().reads_writes(3, 3)]
|
||||
fn vest_other(origin, target: <T::Lookup as StaticLookup>::Source) -> DispatchResult {
|
||||
ensure_signed(origin)?;
|
||||
Self::update_lock(T::Lookup::lookup(target)?)
|
||||
@@ -240,10 +244,10 @@ decl_module! {
|
||||
/// - DbWeight: 3 Reads, 3 Writes
|
||||
/// - Reads: Vesting Storage, Balances Locks, Target Account, [Sender Account]
|
||||
/// - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]
|
||||
/// - Benchmark: 263 µs (min square analysis)
|
||||
/// - Assuming less than 50 locks on any user, else we may want factor in number of locks.
|
||||
/// - Benchmark: 111.4 + .345 * l µs (min square analysis)
|
||||
/// - Using 115 µs fixed. Assuming less than 50 locks on any user, else we may want factor in number of locks.
|
||||
/// # </weight>
|
||||
#[weight = 300_000_000 + T::DbWeight::get().reads_writes(3, 3)]
|
||||
#[weight = 115_000_000 + T::DbWeight::get().reads_writes(3, 3)]
|
||||
pub fn vested_transfer(
|
||||
origin,
|
||||
target: <T::Lookup as StaticLookup>::Source,
|
||||
|
||||
Reference in New Issue
Block a user