New weights using i7 machine (#5848)

* i7 weights

* fix full block test

* fix merge

* fix priority
This commit is contained in:
Shawn Tabrizi
2020-05-01 14:14:43 +02:00
committed by GitHub
parent 5b4497efcd
commit b913dfebb7
7 changed files with 61 additions and 43 deletions
@@ -130,8 +130,8 @@ parameter_types! {
/// This probably should not be changed unless you have specific /// This probably should not be changed unless you have specific
/// disk i/o conditions for the node. /// disk i/o conditions for the node.
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 60_000_000, // ~0.06 ms = ~60 µs read: 25_000_000, // ~25 µs
write: 200_000_000, // ~0.2 ms = 200 µs write: 100_000_000, // ~100 µs
}; };
} }
+8 -5
View File
@@ -339,7 +339,7 @@ fn full_native_block_import_works() {
phase: Phase::ApplyExtrinsic(0), phase: Phase::ApplyExtrinsic(0),
// timestamp set call with weight 9_000_000 + 2 read + 1 write // timestamp set call with weight 9_000_000 + 2 read + 1 write
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess( 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![], topics: vec![],
}, },
@@ -359,8 +359,9 @@ fn full_native_block_import_works() {
}, },
EventRecord { EventRecord {
phase: Phase::ApplyExtrinsic(1), phase: Phase::ApplyExtrinsic(1),
// Balance Transfer 80_000_000 + 1 Read + 1 Write
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess( 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![], topics: vec![],
}, },
@@ -393,7 +394,7 @@ fn full_native_block_import_works() {
phase: Phase::ApplyExtrinsic(0), phase: Phase::ApplyExtrinsic(0),
// timestamp set call with weight 9_000_000 + 2 read + 1 write // timestamp set call with weight 9_000_000 + 2 read + 1 write
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess( 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![], topics: vec![],
}, },
@@ -415,8 +416,9 @@ fn full_native_block_import_works() {
}, },
EventRecord { EventRecord {
phase: Phase::ApplyExtrinsic(1), phase: Phase::ApplyExtrinsic(1),
// Balance Transfer 80_000_000 + 1 Read + 1 Write
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess( 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![], topics: vec![],
}, },
@@ -438,8 +440,9 @@ fn full_native_block_import_works() {
}, },
EventRecord { EventRecord {
phase: Phase::ApplyExtrinsic(2), phase: Phase::ApplyExtrinsic(2),
// Balance Transfer 80_000_000 + 1 Read + 1 Write
event: Event::frame_system(frame_system::RawEvent::ExtrinsicSuccess( 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![], topics: vec![],
}, },
@@ -230,7 +230,7 @@ fn submitted_transaction_should_be_valid() {
let res = Executive::validate_transaction(source, extrinsic); let res = Executive::validate_transaction(source, extrinsic);
assert_eq!(res.unwrap(), ValidTransaction { assert_eq!(res.unwrap(), ValidTransaction {
priority: 1_411_390_000_000, priority: 1_410_625_000_000,
requires: vec![], requires: vec![],
provides: vec![(address, 0).encode()], provides: vec![(address, 0).encode()],
longevity: 128, longevity: 128,
+2 -2
View File
@@ -124,8 +124,8 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION; pub const Version: RuntimeVersion = VERSION;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 60_000_000, // ~0.06 ms = ~60 µs read: 25_000_000, // ~25 µs
write: 200_000_000, // ~0.2 ms = 200 µs write: 100_000_000, // ~100 µs
}; };
} }
+16 -5
View File
@@ -431,9 +431,12 @@ decl_module! {
/// - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`. /// - 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 /// - `transfer_keep_alive` works the same way as `transfer`, but has an additional
/// check that the transfer will not kill the origin account. /// 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>
#[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( pub fn transfer(
origin, origin,
dest: <T::Lookup as StaticLookup>::Source, dest: <T::Lookup as StaticLookup>::Source,
@@ -456,8 +459,11 @@ decl_module! {
/// # <weight> /// # <weight>
/// - Independent of the arguments. /// - Independent of the arguments.
/// - Contains a limited number of reads and writes. /// - Contains a limited number of reads and writes.
/// ---------------------
/// - Base Weight: 32.6 µs
/// - DB Weight: 1 Read, 1 Write to `who`
/// # </weight> /// # </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( fn set_balance(
origin, origin,
who: <T::Lookup as StaticLookup>::Source, 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 /// - Same as transfer, but additional read and write because the source account is
/// not assumed to be in the overlay. /// not assumed to be in the overlay.
/// # </weight> /// # </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( pub fn force_transfer(
origin, origin,
source: <T::Lookup as StaticLookup>::Source, source: <T::Lookup as StaticLookup>::Source,
@@ -518,7 +524,12 @@ decl_module! {
/// 99% of the time you want [`transfer`] instead. /// 99% of the time you want [`transfer`] instead.
/// ///
/// [`transfer`]: struct.Module.html#method.transfer /// [`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( pub fn transfer_keep_alive(
origin, origin,
dest: <T::Lookup as StaticLookup>::Source, dest: <T::Lookup as StaticLookup>::Source,
+19 -19
View File
@@ -205,17 +205,17 @@ mod weight_of {
use super::*; use super::*;
/// - Base Weight: /// - Base Weight:
/// - Create: 137.5 + 0.274 * S µs /// - Create: 59.2 + 0.096 * S µs
/// - Approve: 103.8 + .266 * S µs /// - Approve: 42.27 + .116 * S µs
/// - Complete: 116.2 + .754 * S µs /// - Complete: 50.91 + .232 * S µs
/// - DB Weight: /// - DB Weight:
/// - Reads: Multisig Storage, [Caller Account] /// - Reads: Multisig Storage, [Caller Account]
/// - Writes: Multisig Storage, [Caller Account] /// - Writes: Multisig Storage, [Caller Account]
/// - Plus Call Weight /// - Plus Call Weight
pub fn as_multi<T: Trait>(other_sig_len: usize, call_weight: Weight) -> Weight { pub fn as_multi<T: Trait>(other_sig_len: usize, call_weight: Weight) -> Weight {
call_weight call_weight
.saturating_add(150_000_000) .saturating_add(60_000_000)
.saturating_add((other_sig_len as Weight).saturating_mul(750_000)) .saturating_add((other_sig_len as Weight).saturating_mul(250_000))
.saturating_add(T::DbWeight::get().reads_writes(1, 1)) .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. /// - `calls`: The calls to be dispatched from the same origin.
/// ///
/// # <weight> /// # <weight>
/// - Base weight: 63.78 µs /// - Base weight: 15.64 + .987 * c µs
/// - Plus the sum of the weights of the `calls`. /// - Plus the sum of the weights of the `calls`.
/// - Plus one additional event. (repeat read/write) /// - Plus one additional event. (repeat read/write)
/// # </weight> /// # </weight>
@@ -250,7 +250,7 @@ decl_module! {
|args: (&Vec<<T as Trait>::Call>,)| { |args: (&Vec<<T as Trait>::Call>,)| {
args.0.iter() args.0.iter()
.map(|call| call.get_dispatch_info().weight) .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>,)| { |args: (&Vec<<T as Trait>::Call>,)| {
let all_operational = args.0.iter() let all_operational = args.0.iter()
@@ -280,12 +280,12 @@ decl_module! {
/// The dispatch origin for this call must be _Signed_. /// The dispatch origin for this call must be _Signed_.
/// ///
/// # <weight> /// # <weight>
/// - Base weight: 5.1 µs /// - Base weight: 2.863 µs
/// - Plus the weight of the `call` /// - Plus the weight of the `call`
/// # </weight> /// # </weight>
#[weight = FunctionOf( #[weight = FunctionOf(
|args: (&u16, &Box<<T as Trait>::Call>)| { |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, |args: (&u16, &Box<<T as Trait>::Call>)| args.1.get_dispatch_info().class,
Pays::Yes, Pays::Yes,
@@ -339,9 +339,9 @@ decl_module! {
/// `MultisigDepositBase + threshold * MultisigDepositFactor`. /// `MultisigDepositBase + threshold * MultisigDepositFactor`.
/// ------------------------------- /// -------------------------------
/// - Base Weight: /// - Base Weight:
/// - Create: 137.5 + 0.274 * S µs /// - Create: 59.2 + 0.096 * S µs
/// - Approve: 103.8 + .266 * S µs /// - Approve: 42.27 + .116 * S µs
/// - Complete: 116.2 + .754 * S µs /// - Complete: 50.91 + .232 * S µs
/// - DB Weight: /// - DB Weight:
/// - Reads: Multisig Storage, [Caller Account] /// - Reads: Multisig Storage, [Caller Account]
/// - Writes: Multisig Storage, [Caller Account] /// - Writes: Multisig Storage, [Caller Account]
@@ -471,8 +471,8 @@ decl_module! {
/// `MultisigDepositBase + threshold * MultisigDepositFactor`. /// `MultisigDepositBase + threshold * MultisigDepositFactor`.
/// ---------------------------------- /// ----------------------------------
/// - Base Weight: /// - Base Weight:
/// - Create: 139.1 + 0.202 * S /// - Create: 56.3 + 0.107 * S
/// - Approve: 96.6 + 0.328 * S /// - Approve: 39.25 + 0.121 * S
/// - DB Weight: /// - DB Weight:
/// - Read: Multisig Storage, [Caller Account] /// - Read: Multisig Storage, [Caller Account]
/// - Write: Multisig Storage, [Caller Account] /// - Write: Multisig Storage, [Caller Account]
@@ -480,8 +480,8 @@ decl_module! {
#[weight = FunctionOf( #[weight = FunctionOf(
|args: (&u16, &Vec<T::AccountId>, &Option<Timepoint<T::BlockNumber>>, &[u8; 32])| { |args: (&u16, &Vec<T::AccountId>, &Option<Timepoint<T::BlockNumber>>, &[u8; 32])| {
T::DbWeight::get().reads_writes(1, 1) T::DbWeight::get().reads_writes(1, 1)
.saturating_add(140_000_000) .saturating_add(60_000_000)
.saturating_add((args.1.len() as Weight).saturating_mul(350_000)) .saturating_add((args.1.len() as Weight).saturating_mul(120_000))
}, },
DispatchClass::Normal, DispatchClass::Normal,
Pays::Yes, Pays::Yes,
@@ -554,7 +554,7 @@ decl_module! {
/// - I/O: 1 read `O(S)`, one remove. /// - I/O: 1 read `O(S)`, one remove.
/// - Storage: removes one item. /// - Storage: removes one item.
/// ---------------------------------- /// ----------------------------------
/// - Base Weight: 126.6 + 0.126 * S /// - Base Weight: 46.71 + 0.09 * S
/// - DB Weight: /// - DB Weight:
/// - Read: Multisig Storage, [Caller Account] /// - Read: Multisig Storage, [Caller Account]
/// - Write: Multisig Storage, [Caller Account] /// - Write: Multisig Storage, [Caller Account]
@@ -562,8 +562,8 @@ decl_module! {
#[weight = FunctionOf( #[weight = FunctionOf(
|args: (&u16, &Vec<T::AccountId>, &Timepoint<T::BlockNumber>, &[u8; 32])| { |args: (&u16, &Vec<T::AccountId>, &Timepoint<T::BlockNumber>, &[u8; 32])| {
T::DbWeight::get().reads_writes(1, 1) T::DbWeight::get().reads_writes(1, 1)
.saturating_add(130_000_000) .saturating_add(50_000_000)
.saturating_add((args.1.len() as Weight).saturating_mul(130_000)) .saturating_add((args.1.len() as Weight).saturating_mul(100_000))
}, },
DispatchClass::Normal, DispatchClass::Normal,
Pays::Yes, Pays::Yes,
+13 -9
View File
@@ -193,10 +193,12 @@ decl_module! {
/// - DbWeight: 2 Reads, 2 Writes /// - DbWeight: 2 Reads, 2 Writes
/// - Reads: Vesting Storage, Balances Locks, [Sender Account] /// - Reads: Vesting Storage, Balances Locks, [Sender Account]
/// - Writes: Vesting Storage, Balances Locks, [Sender Account] /// - Writes: Vesting Storage, Balances Locks, [Sender Account]
/// - Benchmark: 147.5 µs (min square analysis) /// - Benchmark:
/// - Assuming less than 50 locks on any user, else we may want factor in number of locks. /// - 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>
#[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 { fn vest(origin) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
Self::update_lock(who) Self::update_lock(who)
@@ -216,10 +218,12 @@ decl_module! {
/// - DbWeight: 3 Reads, 3 Writes /// - DbWeight: 3 Reads, 3 Writes
/// - Reads: Vesting Storage, Balances Locks, Target Account /// - Reads: Vesting Storage, Balances Locks, Target Account
/// - Writes: Vesting Storage, Balances Locks, Target Account /// - Writes: Vesting Storage, Balances Locks, Target Account
/// - Benchmark: 150.4 µs (min square analysis) /// - Benchmark:
/// - Assuming less than 50 locks on any user, else we may want factor in number of locks. /// - 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>
#[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 { fn vest_other(origin, target: <T::Lookup as StaticLookup>::Source) -> DispatchResult {
ensure_signed(origin)?; ensure_signed(origin)?;
Self::update_lock(T::Lookup::lookup(target)?) Self::update_lock(T::Lookup::lookup(target)?)
@@ -240,10 +244,10 @@ decl_module! {
/// - DbWeight: 3 Reads, 3 Writes /// - DbWeight: 3 Reads, 3 Writes
/// - Reads: Vesting Storage, Balances Locks, Target Account, [Sender Account] /// - Reads: Vesting Storage, Balances Locks, Target Account, [Sender Account]
/// - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account] /// - Writes: Vesting Storage, Balances Locks, Target Account, [Sender Account]
/// - Benchmark: 263 µs (min square analysis) /// - Benchmark: 111.4 + .345 * l µs (min square analysis)
/// - Assuming less than 50 locks on any user, else we may want factor in number of locks. /// - Using 115 µs fixed. Assuming less than 50 locks on any user, else we may want factor in number of locks.
/// # </weight> /// # </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( pub fn vested_transfer(
origin, origin,
target: <T::Lookup as StaticLookup>::Source, target: <T::Lookup as StaticLookup>::Source,