Skip to content

Commit

Permalink
Add performance benchmarking logic to time_expr! macro
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgiosDelkos committed Nov 1, 2024
1 parent 85950cb commit 41c53ba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sway-utils/src/performance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ macro_rules! time_expr {
if let Some(cfg) = $build_config {
if cfg.profile {
println!("/dyno start {} {}", $pkg_name, $description);
{
let mut x = vec![];
for i in 0..10_000_000 {
let z = i * i;
x.push(z);
}
}
let output = { $expression };
println!("/dyno stop {} {}", $pkg_name, $description);
output
Expand Down

0 comments on commit 41c53ba

Please sign in to comment.