-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Use DependentCost
for aloc
opcode
#1934
Changes from all commits
81dc78a
42105ce
e14cf0b
5caec42
6340785
22fa926
8c276e9
0b11719
4c6f29b
22f3ba4
4f9340c
57d2049
0e41a28
a762483
131a91e
98c7495
395077b
36fa8be
3baea26
b13578f
eb65aba
5196bab
2e4bc5b
c2034bb
ec2a65b
fc15915
6000f11
56915e7
564fec0
a719693
c8248b9
38f57f9
de2ec13
7ac5fa5
62e6f24
ae90adf
cbd73d9
13fe891
703033a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ use criterion::{ | |
Criterion, | ||
Throughput, | ||
}; | ||
use fuel_core_storage::InterpreterStorage; | ||
use fuel_core_types::{ | ||
fuel_asm::{ | ||
op, | ||
|
@@ -23,17 +22,8 @@ use fuel_core_types::{ | |
checked_transaction::{ | ||
Checked, | ||
IntoChecked, | ||
Ready, | ||
}, | ||
constraints::reg_key::{ | ||
Reg, | ||
RegMut, | ||
}, | ||
consts::VM_MAX_RAM, | ||
interpreter::{ | ||
MemoryInstance, | ||
NotSupportedEcal, | ||
}, | ||
interpreter::NotSupportedEcal, | ||
Interpreter, | ||
}, | ||
}; | ||
|
@@ -110,56 +100,14 @@ pub fn vm_initialization(c: &mut Criterion) { | |
group.throughput(Throughput::Bytes(tx_size as u64)); | ||
group.bench_function(name, |b| { | ||
b.iter(|| { | ||
unoptimized_vm_initialization_with_allocating_full_range_of_memory( | ||
&mut vm, &tx, | ||
#[allow(clippy::unit_arg)] | ||
black_box( | ||
Comment on lines
+103
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
vm.init_script(tx.clone()) | ||
.expect("Should be able to execute transaction"), | ||
); | ||
}) | ||
}); | ||
} | ||
|
||
group.finish(); | ||
} | ||
|
||
#[allow(clippy::unit_arg)] | ||
fn unoptimized_vm_initialization_with_allocating_full_range_of_memory<S>( | ||
vm: &mut Interpreter<MemoryInstance, S, Script>, | ||
ready_tx: &Ready<Script>, | ||
) where | ||
S: InterpreterStorage, | ||
{ | ||
black_box(initialize_vm_with_allocated_full_range_of_memory( | ||
black_box(ready_tx.clone()), | ||
vm, | ||
)); | ||
} | ||
|
||
fn initialize_vm_with_allocated_full_range_of_memory<S>( | ||
ready_tx: Ready<Script>, | ||
vm: &mut Interpreter<MemoryInstance, S, Script>, | ||
) where | ||
S: InterpreterStorage, | ||
{ | ||
vm.init_script(ready_tx) | ||
.expect("Should be able to execute transaction"); | ||
|
||
const POWER_OF_TWO_OF_HALF_VM: u64 = 25; | ||
const VM_MEM_HALF: u64 = 1 << POWER_OF_TWO_OF_HALF_VM; | ||
assert_eq!(VM_MEM_HALF, VM_MAX_RAM / 2); | ||
let mut hp = VM_MAX_RAM; | ||
|
||
for i in 0..=POWER_OF_TWO_OF_HALF_VM { | ||
let stack = 1 << i; | ||
let heap = stack / 2; | ||
|
||
vm.memory_mut() | ||
.grow_stack(stack) | ||
.expect("Should be able to grow stack"); | ||
vm.memory_mut() | ||
.grow_heap_by(Reg::new(&0), RegMut::new(&mut hp), heap) | ||
.expect("Should be able to grow heap"); | ||
} | ||
|
||
vm.memory_mut() | ||
.grow_heap_by(Reg::new(&0), RegMut::new(&mut hp), VM_MEM_HALF) | ||
.expect("Should be able to grow heap"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog says your updating to
0.51.0
, not0.52.0
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog related for
0.51.0
is from another PR, I just grouped everything together=)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like we are being inconsistent about when we note these things, but I don't know that it matters