Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
fc09727
chore(benchmarks): add benchmarks for niop opcode in all operation modes
rymnc Jul 2, 2025
9d77687
Merge branch 'master' into chore/update-benchmarks
rymnc Jul 2, 2025
73b6353
fix: fmt
rymnc Jul 2, 2025
7bc5f3d
chore: fmt
rymnc Jul 2, 2025
64d766c
chore: reduce value count
rymnc Jul 2, 2025
ab53991
fix: exp bounds
rymnc Jul 2, 2025
b535742
fix: min max
rymnc Jul 2, 2025
ee93d38
chore: rename var
rymnc Jul 3, 2025
34a7219
Merge branch 'master' into chore/update-benchmarks
xgreenx Jul 26, 2025
1194f9f
Merge branch 'master' into chore/update-benchmarks
xgreenx Jul 26, 2025
06a7153
Merge branch 'master' into chore/update-benchmarks
xgreenx Jul 26, 2025
22bf26b
Merge branch 'master' into chore/update-benchmarks
xgreenx Jul 27, 2025
8934466
chore: make contract benches work
rymnc Jul 29, 2025
4bafd07
Merge branch 'master' into chore/update-benchmarks
rymnc Jul 29, 2025
dfdaaad
fix: cfe before the logd
rymnc Jul 31, 2025
2deb52d
fix: retd contract
rymnc Aug 1, 2025
43eefdf
fix: memory opcodes
rymnc Aug 1, 2025
a01a7c9
fix: meq
rymnc Aug 2, 2025
2a9eee6
chore: update to 60m gas
rymnc Aug 3, 2025
a71d5f4
fix: ldc for 60m gas
rymnc Aug 3, 2025
3947ea1
fix: ldc
rymnc Aug 4, 2025
56710d1
fix: ldc going beyond vm max memory
rymnc Aug 4, 2025
889dfb0
fix: fmt
rymnc Aug 4, 2025
8ba8996
chore: easier way
rymnc Aug 4, 2025
ccf60a7
chore: new gas costs
rymnc Aug 4, 2025
5657f86
test?
rymnc Aug 7, 2025
4f7de1c
Merge branch 'master' into chore/update-benchmarks
xgreenx Aug 11, 2025
b7565bb
Merge branch 'master' into chore/update-benchmarks
xgreenx Sep 15, 2025
30e43b4
Merge branch 'master' into chore/update-benchmarks
xgreenx Sep 15, 2025
83e333e
Merge branch 'master' into chore/update-benchmarks
xgreenx Sep 16, 2025
427c5ef
Optimized serialization and deserialization in `fuel-core` and `fuel-…
xgreenx Sep 17, 2025
45eea7c
chore: update default_gas_costs
rymnc Sep 17, 2025
f232a0c
chore: change target block gas limit to 1M
rymnc Sep 17, 2025
69d60ec
Revert changes related to ldc
xgreenx Sep 17, 2025
0b50661
Reuse memory during block production and validation during native exe…
xgreenx Oct 1, 2025
085317e
Merge branch 'refs/heads/master' into chore/update-benchmarks
xgreenx Oct 9, 2025
2573eaa
Use `fuel-vm 0.64.0`
xgreenx Oct 9, 2025
2ea4c11
Updated
xgreenx Oct 9, 2025
d12b3a5
Updated added section
xgreenx Oct 9, 2025
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
7 changes: 7 additions & 0 deletions .changes/added/3050.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
A new benchmarking group for `niop` operations in the `alu.rs` file. The changes add comprehensive benchmarks for various operations (`ADD`, `SUB`, `MUL`, `EXP`, `SLL`, `XNOR`) across different operand widths (`U8`, `U16`, `U32`)

### Additions to benchmarking:

* A new `niop` benchmarking group was added to evaluate the performance of narrow integer operations (`niop`) with different operand widths (`U8`, `U16`, `U32`).
* Introduced the `niop_bench` macro to simplify the creation of benchmarks for operations like `ADD`, `SUB`, `MUL`, `EXP`, `SLL`, and `XNOR`.
* Benchmarks iterate over generated operand pairs for each width, ensuring a variety of test cases for each operation.
4 changes: 4 additions & 0 deletions .changes/breaking/3050.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Used a new `fuel-vm 0.64.0` release which brings breaking changes: https://github.com/FuelLabs/fuel-vm/releases/tag/v0.64.0
- The default gas cost has been changed according to new optimizations and a new benchmark machine for a local node.
- Receipts now are behind an `Arc` pointer to avoid unnecessary cloning. It affects transaction states and preconfirmations.
- The `deploy_contract_with_id` now works with `[u8]` instead of the `Contract` type.
8 changes: 8 additions & 0 deletions .changes/changed/3050.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Actualized benchmarks with the performance of the network. With this change we should be able to run benchmarks on nightly bases.

Added several optimizations to the code base:
- Executor now reuses the memory instance between blocks production and validation avoiding allocations.
- Receipts are not cloned anymore from the VM. Instead, they are extracted from the VM and stored ina s shared pointer.
- The gas usage for script is discovered in a faster way.
- `Create` transaction doesn't require a cloning of the contract bytecode anymore to calculate its `ContractId`.
- Serialization and deserialization of the bytes became much faster for canonical, `postcard`, `bincode` codecs.
74 changes: 38 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fuel-core-wasm-executor = { version = "0.46.0", path = "./crates/services/upgrad
fuel-gas-price-algorithm = { version = "0.46.0", path = "crates/fuel-gas-price-algorithm" }

# Fuel dependencies
fuel-vm-private = { version = "0.63.0", package = "fuel-vm", default-features = false }
fuel-vm-private = { version = "0.64.0", package = "fuel-vm", default-features = false }
futures = "0.3"
hex = { version = "0.4", features = ["serde"] }
hyper = { version = "0.14.26" }
Expand Down
62 changes: 51 additions & 11 deletions benches/benches/block_target_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,25 @@ pub struct MultiContractBenchmarkRunnerBuilder {
rng: rand::rngs::StdRng,
}

#[derive(Debug, Clone)]
pub struct BenchContract {
contract_id: ContractId,
bytecode: Option<Vec<u8>>,
}

impl SanityBenchmarkRunnerBuilder {
/// Creates a factory for benchmarks that share a service with a contract, `contract_id`, pre-
/// deployed.
/// The size of the database can be overridden with the `STATE_SIZE` environment variable.
pub fn new_shared(contract_id: ContractId) -> SharedSanityBenchmarkRunnerBuilder {
let state_size = crate::utils::get_state_size();
let (service, rt) = service_with_many_contracts(state_size, vec![contract_id]);
let (service, rt) = service_with_many_contracts(
state_size,
vec![BenchContract {
contract_id,
bytecode: None,
}],
);
let rng = rand::rngs::StdRng::seed_from_u64(2322u64);
SharedSanityBenchmarkRunnerBuilder {
service,
Expand All @@ -144,11 +156,37 @@ impl SanityBenchmarkRunnerBuilder {
}
}

pub fn new_shared_with_contract(
contract: BenchContract,
) -> SharedSanityBenchmarkRunnerBuilder {
let state_size = crate::utils::get_state_size();
let contract_id = *contract.contract_id;
let (service, rt) = service_with_many_contracts(state_size, vec![contract]);
let rng = rand::rngs::StdRng::seed_from_u64(2322u64);

SharedSanityBenchmarkRunnerBuilder {
service,
rt,
contract_id: contract_id.into(),
rng,
}
}

pub fn new_with_many_contracts(
contract_ids: Vec<ContractId>,
) -> MultiContractBenchmarkRunnerBuilder {
let state_size = 1000; // Arbitrary small state size
let (service, rt) = service_with_many_contracts(state_size, contract_ids.clone());
let (service, rt) = service_with_many_contracts(
state_size,
contract_ids
.iter()
.cloned()
.map(|id| BenchContract {
contract_id: id,
bytecode: None,
})
.collect(),
);
let rng = rand::rngs::StdRng::seed_from_u64(2322u64);
MultiContractBenchmarkRunnerBuilder {
service,
Expand Down Expand Up @@ -247,7 +285,7 @@ fn run(
) {
let mut rng = rand::rngs::StdRng::seed_from_u64(2322u64);
let contract_ids = vec![];
let (service, rt) = service_with_many_contracts(0, contract_ids.clone()); // Doesn't need any contracts
let (service, rt) = service_with_many_contracts(0, vec![]); // Doesn't need any contracts
run_with_service_with_extra_inputs(
id,
group,
Expand All @@ -266,9 +304,9 @@ fn run(
/// `state_size` for each contract.
fn service_with_many_contracts(
state_size: u64,
contract_ids: Vec<ContractId>,
contracts: Vec<BenchContract>,
) -> (FuelService, tokio::runtime::Runtime) {
let rt = tokio::runtime::Builder::new_current_thread()
let rt = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
.unwrap();
Expand Down Expand Up @@ -301,10 +339,11 @@ fn service_with_many_contracts(
.consensus_parameters
.set_gas_costs(GasCosts::new(default_gas_costs()));

let contract_configs = contract_ids
let contract_configs = contracts
.iter()
.map(|contract_id| ContractConfig {
contract_id: *contract_id,
.map(|contract| ContractConfig {
contract_id: (*contract.contract_id).into(),
code: contract.bytecode.clone().unwrap_or_default(),
..Default::default()
})
.collect::<Vec<_>>();
Expand All @@ -320,10 +359,11 @@ fn service_with_many_contracts(
let mut storage_key = primitive_types::U256::zero();
let mut key_bytes = Bytes32::zeroed();

for contract_id in contract_ids.iter() {
for contract in contracts.iter() {
let contract_id = contract.contract_id;
database
.init_contract_state(
contract_id,
&contract_id,
(0..state_size).map(|_| {
storage_key.to_big_endian(key_bytes.as_mut());
storage_key.increase().unwrap();
Expand All @@ -336,7 +376,7 @@ fn service_with_many_contracts(
let mut sub_id = SubAssetId::zeroed();
database
.init_contract_balances(
contract_id,
&contract_id,
(0..state_size).map(|k| {
storage_key.to_big_endian(sub_id.as_mut());

Expand Down
Loading
Loading