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:
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
;; Complex Data Structure Test
|
;; Complex Data Structure Test
|
||||||
;; Benchmark: 49.8us
|
;; Benchmark: 50.2us
|
||||||
;; Output: {:input 10, :name "Fibonacci", :output 55}
|
;; Output: {:input 10, :name "Fibonacci", :output 55}
|
||||||
(do
|
(do
|
||||||
(def fib (fn [n]
|
(def fib (fn [n]
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
;; Benchmark: 300ns
|
||||||
;; Output: 5
|
;; Output: 5
|
||||||
(do
|
(do
|
||||||
(def y 1)
|
(def y 1)
|
||||||
|
|||||||
+12
@@ -397,6 +397,18 @@ impl eframe::App for CompilerApp {
|
|||||||
{
|
{
|
||||||
self.run_all_tests();
|
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);
|
ui.add_space(2.0);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user