Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Bump contract benches repetition
Browse files Browse the repository at this point in the history
The FRAME benchmarking does not handle the case well where a linear
component as only a range of [0, =1] since in this case it has to
calculate a linear formula from just two points which is unstable.

Now bumping these upper limits back API_BENCHMARK_BATCHES should
improve stability.

This partially reverts 2eb8ad2

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Mar 10, 2023
1 parent 8f9b074 commit 5ae22be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frame/contracts/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1988,7 +1988,7 @@ benchmarks! {
// Only the overhead of calling the function itself with minimal arguments.
#[pov_mode = Measured]
seal_hash_sha2_256 {
let r in 0 .. 1;
let r in 0 .. API_BENCHMARK_BATCHES;
let instance = Contract::<T>::new(WasmModule::hasher(
"seal_hash_sha2_256", r * API_BENCHMARK_BATCH_SIZE, 0,
), vec![])?;
Expand All @@ -2008,7 +2008,7 @@ benchmarks! {
// Only the overhead of calling the function itself with minimal arguments.
#[pov_mode = Measured]
seal_hash_keccak_256 {
let r in 0 .. 1;
let r in 0 .. API_BENCHMARK_BATCHES;
let instance = Contract::<T>::new(WasmModule::hasher(
"seal_hash_keccak_256", r * API_BENCHMARK_BATCH_SIZE, 0,
), vec![])?;
Expand All @@ -2028,7 +2028,7 @@ benchmarks! {
// Only the overhead of calling the function itself with minimal arguments.
#[pov_mode = Measured]
seal_hash_blake2_256 {
let r in 0 .. 1;
let r in 0 .. API_BENCHMARK_BATCHES;
let instance = Contract::<T>::new(WasmModule::hasher(
"seal_hash_blake2_256", r * API_BENCHMARK_BATCH_SIZE, 0,
), vec![])?;
Expand All @@ -2048,7 +2048,7 @@ benchmarks! {
// Only the overhead of calling the function itself with minimal arguments.
#[pov_mode = Measured]
seal_hash_blake2_128 {
let r in 0 .. 1;
let r in 0 .. API_BENCHMARK_BATCHES;
let instance = Contract::<T>::new(WasmModule::hasher(
"seal_hash_blake2_128", r * API_BENCHMARK_BATCH_SIZE, 0,
), vec![])?;
Expand All @@ -2069,7 +2069,7 @@ benchmarks! {
// It generates different private keys and signatures for the message "Hello world".
#[pov_mode = Measured]
seal_ecdsa_recover {
let r in 0 .. 1;
let r in 0 .. API_BENCHMARK_BATCHES;

let message_hash = sp_io::hashing::blake2_256("Hello world".as_bytes());
let key_type = sp_core::crypto::KeyTypeId(*b"code");
Expand Down Expand Up @@ -2118,7 +2118,7 @@ benchmarks! {
// generated different ECDSA keys.
#[pov_mode = Measured]
seal_ecdsa_to_eth_address {
let r in 0 .. 1;
let r in 0 .. API_BENCHMARK_BATCHES;
let key_type = sp_core::crypto::KeyTypeId(*b"code");
let pub_keys_bytes = (0..r * API_BENCHMARK_BATCH_SIZE)
.flat_map(|_| {
Expand Down

0 comments on commit 5ae22be

Please sign in to comment.