tellor-io / tellor-pallet

GNU General Public License v3.0
7 stars 3 forks source link

Investigate benchmarks for range params #106

Open pawanbisht62 opened 1 year ago

pawanbisht62 commented 1 year ago

In this issue, we need to investigate on why benchmarks are not using make use of range params in the generated weight functions.

Here is the example code:

/// Storage: Tellor ReportedTimestampCount (r:1 w:1)
/// Proof: Tellor ReportedTimestampCount (max_values: None, max_size: Some(36), added: 2511, mode: MaxEncodedLen)
/// Storage: Tellor StakerDetails (r:1 w:1)
/// Proof: Tellor StakerDetails (max_values: None, max_size: Some(213), added: 2688, mode: MaxEncodedLen)
/// Storage: Tellor StakeAmount (r:1 w:0)
/// Proof: Tellor StakeAmount (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
/// Storage: Timestamp Now (r:1 w:0)
/// Proof: Timestamp Now (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Tellor ReportersByTimestamp (r:1 w:1)
/// Proof: Tellor ReportersByTimestamp (max_values: None, max_size: Some(88), added: 2563, mode: MaxEncodedLen)
/// Storage: Tellor StakerReportsSubmittedByQueryId (r:1 w:1)
/// Proof: Tellor StakerReportsSubmittedByQueryId (max_values: None, max_size: Some(96), added: 2571, mode: MaxEncodedLen)
/// Storage: Tellor ReportedTimestampsByIndex (r:0 w:1)
/// Proof: Tellor ReportedTimestampsByIndex (max_values: None, max_size: Some(60), added: 2535, mode: MaxEncodedLen)
/// Storage: Tellor ReportedTimestamps (r:0 w:1)
/// Proof: Tellor ReportedTimestamps (max_values: None, max_size: Some(60), added: 2535, mode: MaxEncodedLen)
/// Storage: Tellor TimeOfLastNewValue (r:0 w:1)
/// Proof: Tellor TimeOfLastNewValue (max_values: Some(1), max_size: Some(8), added: 503, mode: MaxEncodedLen)
/// Storage: Tellor ReportedTimestampsToBlockNumber (r:0 w:1)
/// Proof: Tellor ReportedTimestampsToBlockNumber (max_values: None, max_size: Some(60), added: 2535, mode: MaxEncodedLen)
/// Storage: Tellor ReportedValuesByTimestamp (r:0 w:1)
/// Proof: Tellor ReportedValuesByTimestamp (max_values: None, max_size: Some(314), added: 2789, mode: MaxEncodedLen)
/// The range of component `q` is `[1, 512]`.
/// The range of component `v` is `[1, 256]`.
fn submit_value(_q: u32, _v: u32, ) -> Weight {
// Proof Size summary in bytes:
//  Measured:  `457`
//  Estimated: `17303`
// Minimum execution time: 37_000_000 picoseconds.
Weight::from_parts(41_506_853, 17303)
    .saturating_add(T::DbWeight::get().reads(6_u64))
    .saturating_add(T::DbWeight::get().writes(9_u64))
}
evilrobot-01 commented 1 year ago

This seems to disappear when increasing the the number of steps and repeats, but it would be good to confirm this by testing #111 on your machine with the command shown in weights.rs to see if you get similar results.