Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create sanity benchmark checks for all the arithmetic op codes #1419

Merged
merged 10 commits into from
Oct 17, 2023
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Description of the upcoming release here.

### Added

- [#1411](https://github.com/FuelLabs/fuel-core/pull/1411) Added WASM and `no_std` compatibility
- [#1419](https://github.com/FuelLabs/fuel-core/pull/1419): Add additional "sanity" benchmarks for arithmetic op code instructions.
- [#1411](https://github.com/FuelLabs/fuel-core/pull/1411): Added WASM and `no_std` compatibility
- [#1371](https://github.com/FuelLabs/fuel-core/pull/1371): Add new client function for querying the `MessageStatus` for a specific message (by `Nonce`)
- [#1356](https://github.com/FuelLabs/fuel-core/pull/1356): Add peer reputation reporting to heartbeat code
- [#1355](https://github.com/FuelLabs/fuel-core/pull/1355): Added new metrics related to block importing, such as tps, sync delays etc
Expand Down
50 changes: 32 additions & 18 deletions benches/benches/block_target_gas.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use block_target_gas_set::alu::run_alu;
use criterion::{
criterion_group,
criterion_main,
Expand All @@ -13,10 +14,19 @@ use fuel_core::service::{
};
use rand::SeedableRng;

use ethnum::U256;
use fuel_core_benches::*;
use fuel_core_types::{
fuel_asm::{
op,
wideint::{
CompareArgs,
CompareMode,
DivArgs,
MathArgs,
MathOp,
MulArgs,
},
GTFArgs,
Instruction,
RegId,
Expand All @@ -29,6 +39,15 @@ use fuel_core_types::{
fuel_types::AssetId,
};

mod utils;

mod block_target_gas_set;

use utils::{
make_u128,
make_u256,
};

// Use Jemalloc during benchmarks
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
Expand Down Expand Up @@ -72,17 +91,17 @@ fn run(
script.clone().into_iter().collect(),
script_data.clone(),
)
.gas_limit(TARGET_BLOCK_GAS_LIMIT - BASE)
.gas_price(1)
.add_unsigned_coin_input(
SecretKey::random(&mut rng),
rng.gen(),
u64::MAX,
AssetId::BASE,
Default::default(),
Default::default(),
)
.finalize_as_transaction();
.gas_limit(TARGET_BLOCK_GAS_LIMIT - BASE)
.gas_price(1)
.add_unsigned_coin_input(
SecretKey::random(&mut rng),
rng.gen(),
u64::MAX,
AssetId::BASE,
Default::default(),
Default::default(),
)
.finalize_as_transaction();
async move {
let tx_id = tx.id(&config.chain_conf.consensus_parameters.chain_id);

Expand Down Expand Up @@ -116,13 +135,6 @@ fn run(
fn block_target_gas(c: &mut Criterion) {
let mut group = c.benchmark_group("block target estimation");

run(
"Script with noop opcode and infinite loop",
&mut group,
[op::noop(), op::jmpb(RegId::ZERO, 0)].to_vec(),
vec![],
);

run(
"Script with meq opcode and infinite loop",
&mut group,
Expand Down Expand Up @@ -239,6 +251,8 @@ fn block_target_gas(c: &mut Criterion) {
// .to_vec(),
// );

run_alu(&mut group);

group.finish();
}

Expand Down
Loading
Loading