From 41c53ba4edd9e0b2b3001e89da8344a170a0dab5 Mon Sep 17 00:00:00 2001 From: GeorgiosDelkos Date: Fri, 1 Nov 2024 11:17:06 +0200 Subject: [PATCH] Add performance benchmarking logic to time_expr! macro --- sway-utils/src/performance.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sway-utils/src/performance.rs b/sway-utils/src/performance.rs index 479c229..bf837ff 100644 --- a/sway-utils/src/performance.rs +++ b/sway-utils/src/performance.rs @@ -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