Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
7fdb085
weights with metadata
shawntabrizi Aug 1, 2021
f69cd5c
fix
shawntabrizi Aug 1, 2021
e7efad7
Merge branch 'master' into shawntabrizi-weights-with-meta
shawntabrizi Aug 2, 2021
531b453
fix contract test
shawntabrizi Aug 2, 2021
81f9d55
skip metadata tag
shawntabrizi Aug 2, 2021
25d3602
special handling for `frame_system`
shawntabrizi Aug 2, 2021
15f29d2
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 2, 2021
4fc313f
add skip metadata to contracts
shawntabrizi Aug 2, 2021
66d3fc0
Merge branch 'shawntabrizi-weights-with-meta' of https://github.com/p…
shawntabrizi Aug 2, 2021
8359527
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 2, 2021
5aa9923
fix contract test
shawntabrizi Aug 2, 2021
46a9453
Merge branch 'master' of https://github.com/paritytech/substrate into…
Aug 3, 2021
8726fe6
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 3, 2021
4851b71
Merge branch 'master' of https://github.com/paritytech/substrate into…
Aug 3, 2021
b2f5a90
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 3, 2021
ab6bfa0
Merge branch 'master' into shawntabrizi-weights-with-meta
shawntabrizi Aug 5, 2021
c4fa70f
expose component information
shawntabrizi Aug 5, 2021
1ea319f
fix test generation
shawntabrizi Aug 5, 2021
22f53f1
refactor list benchmarks
shawntabrizi Aug 5, 2021
b6607a9
move component selection out of runtime
shawntabrizi Aug 5, 2021
27f4181
add benchmark verification
shawntabrizi Aug 5, 2021
13a753a
missing feature
shawntabrizi Aug 5, 2021
42c21d9
Merge branch 'master' of https://github.com/paritytech/substrate into…
Aug 5, 2021
a31813f
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 5, 2021
cccb5e3
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 5, 2021
ffbf1e4
add internal repeats
shawntabrizi Aug 5, 2021
2e04f54
update weights with internal repeats
shawntabrizi Aug 6, 2021
90d9637
fix warning
shawntabrizi Aug 6, 2021
103f6b3
Merge branch 'master' into shawntabrizi-weights-with-meta
shawntabrizi Aug 6, 2021
44c36cb
return error with pov
shawntabrizi Aug 6, 2021
f401c44
try without tracking
shawntabrizi Aug 6, 2021
c882419
Revert "return error with pov"
shawntabrizi Aug 6, 2021
4b4e059
Revert "try without tracking"
shawntabrizi Aug 6, 2021
a0f619e
Revert "Revert "try without tracking""
shawntabrizi Aug 6, 2021
8a038cb
state without tracking
shawntabrizi Aug 6, 2021
ad9ae19
fix build
shawntabrizi Aug 6, 2021
7b01cd1
temp test
shawntabrizi Aug 6, 2021
7f2c7c2
split db and timing benchmarks
shawntabrizi Aug 6, 2021
fa600a7
extend db results?
shawntabrizi Aug 6, 2021
30c03cc
default repeat is internal
shawntabrizi Aug 6, 2021
367e750
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 6, 2021
a37c02a
fix warning
shawntabrizi Aug 6, 2021
24ce8a6
Merge branch 'shawntabrizi-weights-with-meta' of https://github.com/p…
shawntabrizi Aug 6, 2021
ed2ed87
bump linked hash map
shawntabrizi Aug 6, 2021
9189d22
use linked hash map for storage tracker
shawntabrizi Aug 6, 2021
1f45c05
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 6, 2021
4c4db42
remove conflicting short command
shawntabrizi Aug 6, 2021
e9700ef
Merge branch 'shawntabrizi-weights-with-meta' of https://github.com/p…
shawntabrizi Aug 6, 2021
8c24b71
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 6, 2021
342cd7d
missed one linked hashmap
shawntabrizi Aug 6, 2021
3354551
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 6, 2021
1483a9a
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 7, 2021
85ce850
cargo run --quiet --release --features=runtime-benchmarks --manifest-…
Aug 7, 2021
b4c1865
new weights with latest changes
shawntabrizi Aug 7, 2021
5315d3e
Update frame/benchmarking/src/utils.rs
shawntabrizi Aug 7, 2021
7b76d29
Update frame/benchmarking/src/lib.rs
shawntabrizi Aug 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
skip metadata tag
  • Loading branch information
shawntabrizi committed Aug 2, 2021
commit 81f9d55509b7df1e7f84f80de1ff4f164475db38
52 changes: 50 additions & 2 deletions frame/benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ macro_rules! benchmarks {
{ }
( )
( )
( )
$( $rest )*
);
}
Expand All @@ -205,6 +206,7 @@ macro_rules! benchmarks_instance {
{ }
( )
( )
( )
$( $rest )*
);
}
Expand All @@ -223,6 +225,7 @@ macro_rules! benchmarks_instance_pallet {
{ }
( )
( )
( )
$( $rest )*
);
}
Expand All @@ -237,6 +240,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
where_clause { where $( $where_bound:tt )* }
$( $rest:tt )*
) => {
Expand All @@ -245,15 +249,38 @@ macro_rules! benchmarks_iter {
{ $( $where_bound )* }
( $( $names )* )
( $( $names_extra )* )
( $( $names_skip_meta )* )
$( $rest )*
}
};
// detect and extract extra tag:
// detect and extract `#[skip_meta]` tag:
(
{ $( $instance:ident: $instance_bound:tt )? }
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
#[skip_meta]
$name:ident
$( $rest:tt )*
) => {
$crate::benchmarks_iter! {
{ $( $instance: $instance_bound )? }
{ $( $where_clause )* }
( $( $names )* )
( $( $names_extra )* )
( $( $names_skip_meta )* $name )
$name
$( $rest )*
}
};
// detect and extract `#[extra] tag:
(
{ $( $instance:ident: $instance_bound:tt )? }
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
#[extra]
$name:ident
$( $rest:tt )*
Expand All @@ -263,6 +290,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause )* }
( $( $names )* )
( $( $names_extra )* $name )
( $( $names_skip_meta )* )
$name
$( $rest )*
}
Expand All @@ -273,6 +301,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause:tt )* }
( $( $names:tt )* ) // This contains $( $( { $instance } )? $name:ident )*
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
$name:ident { $( $code:tt )* }: _ ( $origin:expr $( , $arg:expr )* )
verify $postcode:block
$( $rest:tt )*
Expand All @@ -282,6 +311,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause )* }
( $( $names )* )
( $( $names_extra )* )
( $( $names_skip_meta )* )
$name { $( $code )* }: $name ( $origin $( , $arg )* )
verify $postcode
$( $rest )*
Expand All @@ -293,6 +323,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
$name:ident { $( $code:tt )* }: $dispatch:ident ( $origin:expr $( , $arg:expr )* )
verify $postcode:block
$( $rest:tt )*
Expand All @@ -302,6 +333,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause )* }
( $( $names )* )
( $( $names_extra )* )
( $( $names_skip_meta )* )
$name {
$( $code )*
let __benchmarked_call_encoded = $crate::frame_support::codec::Encode::encode(
Expand All @@ -328,6 +360,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
$name:ident { $( $code:tt )* }: $eval:block
verify $postcode:block
$( $rest:tt )*
Expand All @@ -354,6 +387,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause )* }
( $( $names )* { $( $instance )? } $name )
( $( $names_extra )* )
( $( $names_skip_meta )* )
$( $rest )*
);
};
Expand All @@ -363,6 +397,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
) => {
$crate::selected_benchmark!(
{ $( $where_clause)* }
Expand All @@ -374,6 +409,7 @@ macro_rules! benchmarks_iter {
{ $( $instance: $instance_bound )? }
( $( $names )* )
( $( $names_extra ),* )
( $( $names_skip_meta ),* )
);
};
// add verify block to _() format
Expand All @@ -382,6 +418,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
$name:ident { $( $code:tt )* }: _ ( $origin:expr $( , $arg:expr )* )
$( $rest:tt )*
) => {
Expand All @@ -390,6 +427,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause )* }
( $( $names )* )
( $( $names_extra )* )
( $( $names_skip_meta )* )
$name { $( $code )* }: _ ( $origin $( , $arg )* )
verify { }
$( $rest )*
Expand All @@ -401,6 +439,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
$name:ident { $( $code:tt )* }: $dispatch:ident ( $origin:expr $( , $arg:expr )* )
$( $rest:tt )*
) => {
Expand All @@ -409,6 +448,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause )* }
( $( $names )* )
( $( $names_extra )* )
( $( $names_skip_meta )* )
$name { $( $code )* }: $dispatch ( $origin $( , $arg )* )
verify { }
$( $rest )*
Expand All @@ -420,6 +460,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause:tt )* }
( $( $names:tt )* )
( $( $names_extra:tt )* )
( $( $names_skip_meta:tt )* )
$name:ident { $( $code:tt )* }: $eval:block
$( $rest:tt )*
) => {
Expand All @@ -428,6 +469,7 @@ macro_rules! benchmarks_iter {
{ $( $where_clause )* }
( $( $names )* )
( $( $names_extra )* )
( $( $names_skip_meta )* )
$name { $( $code )* }: $eval
verify { }
$( $rest )*
Expand Down Expand Up @@ -693,6 +735,7 @@ macro_rules! impl_benchmark {
{ $( $instance:ident: $instance_bound:tt )? }
( $( { $( $name_inst:ident )? } $name:ident )* )
( $( $name_extra:ident ),* )
( $( $name_skip_meta:ident ),* )
) => {
impl<T: Config $(<$instance>, $instance: $instance_bound )? >
$crate::Benchmarking<$crate::BenchmarkResults> for Pallet<T $(, $instance)? >
Expand Down Expand Up @@ -803,7 +846,12 @@ macro_rules! impl_benchmark {
let finish_storage_root = $crate::benchmarking::current_time();
let elapsed_storage_root = finish_storage_root - start_storage_root;

let read_and_written_keys = $crate::benchmarking::get_read_and_written_keys();
let skip_meta = [ $( stringify!($name_skip_meta).as_ref() ),* ];
let read_and_written_keys = if (&skip_meta).contains(&extrinsic) {
$crate::vec![(b"Skipped Metadata".to_vec(), 0, 0, false)]
} else {
$crate::benchmarking::get_read_and_written_keys()
};

results.push($crate::BenchmarkResults {
components: c.to_vec(),
Expand Down
18 changes: 18 additions & 0 deletions frame/benchmarking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,24 @@ mod benchmarks {
variable_components {
let b in ( T::LowerBound::get() ) .. T::UpperBound::get();
}: dummy (RawOrigin::None, b.into())

#[extra]
extra_benchmark {
let b in 1 .. 1000;
let caller = account::<T::AccountId>("caller", 0, 0);
}: set_value(RawOrigin::Signed(caller), b.into())
verify {
assert_eq!(Value::get(), Some(b));
}

#[skip_meta]
skip_meta_benchmark {
let b in 1 .. 1000;
let caller = account::<T::AccountId>("caller", 0, 0);
}: set_value(RawOrigin::Signed(caller), b.into())
verify {
assert_eq!(Value::get(), Some(b));
}
}

#[test]
Expand Down
3 changes: 3 additions & 0 deletions frame/system/benchmarking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ benchmarks! {
assert_eq!(System::<T>::digest().logs.len(), (d + 1) as usize)
}

#[skip_meta]
set_storage {
let i in 1 .. 1000;

Expand All @@ -95,6 +96,7 @@ benchmarks! {
assert_eq!(value, last_hash.as_ref().to_vec());
}

#[skip_meta]
kill_storage {
let i in 1 .. 1000;

Expand All @@ -116,6 +118,7 @@ benchmarks! {
assert_eq!(storage::unhashed::get_raw(last_hash.as_ref()), None);
}

#[skip_meta]
kill_prefix {
let p in 1 .. 1000;

Expand Down
13 changes: 12 additions & 1 deletion utils/frame/benchmarking-cli/src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,21 @@ fn add_storage_comments(
results: &[BenchmarkResults],
storage_info: &[StorageInfo],
) {
let storage_info_map = storage_info
let mut storage_info_map = storage_info
.iter()
.map(|info| (info.prefix.clone(), info))
.collect::<HashMap<_, _>>();

// Special hack to show `Skipped Metadata`
let skip_storage_info = StorageInfo {
pallet_name: b"Skipped".to_vec(),
storage_name: b"Metadata".to_vec(),
prefix: b"Skipped Metadata".to_vec(),
max_values: None,
max_size: None,
};
storage_info_map.insert(skip_storage_info.prefix.clone(), &skip_storage_info);

// This tracks the keys we already identified, so we only generate a single comment.
let mut identified = HashSet::<Vec<u8>>::new();

Expand Down