Skip to content

Commit

Permalink
Merge branch 'master' into 2128-manually-produces-blocks-in-test-and-…
Browse files Browse the repository at this point in the history
…simulates-a-call-the-timestamp-is-not-correct
  • Loading branch information
netrome authored Sep 19, 2024
2 parents a5d2d35 + 525c48f commit 6f54b02
Show file tree
Hide file tree
Showing 11 changed files with 776 additions and 623 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

#### Breaking
- [2206](https://github.com/FuelLabs/fuel-core/pull/2206): Use timestamp of last block when dry running transactions.
- [2153](https://github.com/FuelLabs/fuel-core/pull/2153): Updated default gas costs for the local testnet configuration to match `fuel-core 0.35.0`.

## [Version 0.36.0]

Expand Down
2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fuel-core = { path = "../crates/fuel-core", default-features = false, features =
fuel-core-chain-config = { workspace = true }
fuel-core-database = { path = "./../crates/database" }
fuel-core-services = { path = "./../crates/services" }
fuel-core-storage = { path = "./../crates/storage" }
fuel-core-storage = { path = "./../crates/storage", features = ["smt"] }
fuel-core-sync = { path = "./../crates/services/sync", features = [
"benchmarking",
] }
Expand Down
77 changes: 73 additions & 4 deletions benches/benches/vm_set/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub fn run(c: &mut Criterion) {
let mut ccp = c.benchmark_group("ccp");

for i in linear.clone() {
let mut code = vec![op::noop(); i as usize].into_iter().collect::<Vec<_>>();
let mut code = vec![0; i as usize];

rng.fill_bytes(&mut code);

Expand All @@ -391,10 +391,7 @@ pub fn run(c: &mut Criterion) {
op::movi(0x12, 100_000),
op::movi(0x13, i.try_into().unwrap()),
op::cfe(0x13),
op::movi(0x14, i.try_into().unwrap()),
op::movi(0x15, i.try_into().unwrap()),
op::add(0x15, 0x15, 0x15),
op::addi(0x15, 0x15, 32),
op::aloc(0x15),
op::move_(0x15, RegId::HP),
];
Expand All @@ -413,6 +410,51 @@ pub fn run(c: &mut Criterion) {

ccp.finish();

let mut bldd = c.benchmark_group("bldd");

for i in linear.clone() {
let mut code = vec![0; i as usize];

rng.fill_bytes(&mut code);

let blob = BlobCode::from(code);

let data = blob
.id
.iter()
.copied()
.chain((0 as Word).to_be_bytes().iter().copied())
.chain((0 as Word).to_be_bytes().iter().copied())
.chain(AssetId::default().iter().copied())
.collect();

let prepare_script = vec![
op::gtf_args(0x10, 0x00, GTFArgs::ScriptData),
op::addi(0x11, 0x10, BlobId::LEN.try_into().unwrap()),
op::addi(0x11, 0x11, WORD_SIZE.try_into().unwrap()),
op::addi(0x11, 0x11, WORD_SIZE.try_into().unwrap()),
op::movi(0x12, 100_000),
op::movi(0x13, i.try_into().unwrap()),
op::cfe(0x13),
op::movi(0x15, i.try_into().unwrap()),
op::aloc(0x15),
op::move_(0x15, RegId::HP),
];

bldd.throughput(Throughput::Bytes(i));

run_group_ref(
&mut bldd,
format!("{i}"),
VmBench::new(op::bldd(0x15, 0x10, RegId::ZERO, 0x13))
.with_blob(blob)
.with_data(data)
.with_prepare_script(prepare_script),
);
}

bldd.finish();

let mut csiz = c.benchmark_group("csiz");

for i in linear.clone() {
Expand Down Expand Up @@ -441,6 +483,33 @@ pub fn run(c: &mut Criterion) {

csiz.finish();

let mut bsiz = c.benchmark_group("bsiz");

for i in linear.clone() {
let mut code = vec![0u8; i as usize];

rng.fill_bytes(&mut code);

let blob = BlobCode::from(code);

let data = blob.id.iter().copied().collect();

let prepare_script = vec![op::gtf_args(0x10, 0x00, GTFArgs::ScriptData)];

bsiz.throughput(Throughput::Bytes(i));

run_group_ref(
&mut bsiz,
format!("{i}"),
VmBench::new(op::bsiz(0x11, 0x10))
.with_blob(blob)
.with_data(data)
.with_prepare_script(prepare_script),
);
}

bsiz.finish();

run_group_ref(
&mut c.benchmark_group("bhei"),
"bhei",
Expand Down
18 changes: 14 additions & 4 deletions benches/benches/vm_set/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ use criterion::{
Throughput,
};
use fuel_core_benches::*;
use fuel_core_types::fuel_asm::*;
use fuel_core_types::{
fuel_asm::*,
fuel_vm::{
consts::MEM_SIZE,
interpreter::MemoryInstance,
},
};

pub fn run(c: &mut Criterion) {
run_group_ref(
Expand Down Expand Up @@ -60,8 +66,11 @@ pub fn run(c: &mut Criterion) {
cfe_linear.push(30_000_000);
cfe_linear.push(60_000_000);
for i in cfe_linear {
let bench =
VmBench::new(op::cfe(0x10)).with_prepare_script(set_full_word(0x10, i));
let prepare_script = set_full_word(0x10, i);
let memory = MemoryInstance::from(vec![123; MEM_SIZE]);
let bench = VmBench::new(op::cfe(0x10))
.with_prepare_script(prepare_script)
.with_memory(memory);
cfe.throughput(Throughput::Bytes(i));
run_group_ref(&mut cfe, format!("{i}"), bench);
}
Expand All @@ -77,7 +86,8 @@ pub fn run(c: &mut Criterion) {
cfei_linear.push(1_000_000);
cfei_linear.push(10_000_000);
for i in cfei_linear {
let bench = VmBench::new(op::cfei(i as u32));
let memory = MemoryInstance::from(vec![123; MEM_SIZE]);
let bench = VmBench::new(op::cfei(i as u32)).with_memory(memory);
cfei.throughput(Throughput::Bytes(i));
run_group_ref(&mut cfei, format!("{i}"), bench);
}
Expand Down
4 changes: 2 additions & 2 deletions benches/src/bin/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,12 +642,12 @@ fn linear_regression(x_y: Vec<(u64, u64)>) -> f64 {
}

fn dependent_cost(name: &String, x_y: Vec<(u64, u64)>) -> DependentCost {
const NEAR_LINEAR: f64 = 0.1;
const NEAR_LINEAR: f64 = 0.2;

#[derive(PartialEq, Eq)]
enum Type {
/// The points have a linear property. The first point
/// and the last points are almost the same(The difference is < 0.1).
/// and the last points are almost the same(The difference is < `NEAR_LINEAR`).
Linear,
/// When the delta of the last point is much lower than
/// the first point, it is a logarithmic chart.
Expand Down
Loading

0 comments on commit 6f54b02

Please sign in to comment.