-
Notifications
You must be signed in to change notification settings - Fork 622
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
Base function call computations #4529
Conversation
fn test_function_call(metric: GasMetric, vm_kind: VMKind) { | ||
let mut xs = vec![]; | ||
let mut ys = vec![]; | ||
const REPEATS: i32 = 50; |
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.
const REPEATS: i32 = 50; | |
const REPEATS: u64 = 50; |
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.
Done
" | ||
(export \"hello{}\" (func {})) | ||
(func (;{};) | ||
i32.const {} | ||
drop | ||
return | ||
) | ||
", i, i, i, i) |
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.
" | |
(export \"hello{}\" (func {})) | |
(func (;{};) | |
i32.const {} | |
drop | |
return | |
) | |
", i, i, i, i) | |
r#" | |
(export "hello{i}" (func {i})) | |
(func (;{i};) | |
i32.const {i} | |
drop | |
return | |
) | |
"#, i=i) |
although I guess it's better to use some wat sugar here to not repeat the i in the first place:
write!(
&mut methods,
r#"
(func (export "hello{i}")
i32.const {i}
drop
return
)
"#,
i = i
)
)", | ||
methods | ||
); | ||
ContractCode::new(wabt::wat2wasm(code.as_bytes()).unwrap(), None) |
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.
needs a rebase, we now use wat
instead of wabt
.
#[test] | ||
fn test_function_call_time() { | ||
// Run with | ||
// cargo test --release --lib function_call::test_function_call_time -- --exact --nocapture |
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.
Hm, shouldn't this include --features required
as well?
I think as written, this'll hit the in-memory cache, masking the deserializaion costs, and desiralization should be the primary contributor to func call cost
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.
Done, although from results it doesn't seem so.
test_function_call(GasMetric::ICount, VMKind::Wasmtime); | ||
} | ||
|
||
fn make_many_methods_contact(method_count: i32) -> ContractCode { |
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.
fn make_many_methods_contact(method_count: i32) -> ContractCode { | |
fn make_many_methods_contract(method_count: i32) -> ContractCode { |
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.
Done
let mut ys = vec![]; | ||
const REPEATS: i32 = 50; | ||
for method_count in vec![5, 20, 30, 50, 100, 200, 1000] { | ||
let contract = make_many_methods_contact(method_count); |
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.
Nit
let contract = make_many_methods_contact(method_count); | |
let contract = make_many_methods_contract(method_count); |
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.
Done
No description provided.