Add benchmark button to UI

The benchmark button is only enabled in release builds. If clicked, it
will trigger the benchmark suite.
This commit is contained in:
Michael Schimmel
2026-02-18 21:46:50 +01:00
parent 7a561ab69c
commit 7e54b3f443
3 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
;; Complex Data Structure Test
;; Benchmark: 49.8us
;; Benchmark: 50.2us
;; Output: {:input 10, :name "Fibonacci", :output 55}
(do
(def fib (fn [n]
+1
View File
@@ -1,3 +1,4 @@
;; Benchmark: 300ns
;; Output: 5
(do
(def y 1)
+12
View File
@@ -397,6 +397,18 @@ impl eframe::App for CompilerApp {
{
self.run_all_tests();
}
ui.separator();
let is_debug = cfg!(debug_assertions);
ui.add_enabled_ui(!is_debug, |ui| {
let bench_btn = ui.button("⏱ Bench");
if is_debug {
bench_btn.on_hover_text("Benchmarks are only available in Release builds.");
} else if bench_btn.clicked() {
self.run_benchmarks(false);
}
});
});
ui.add_space(2.0);
});