From 5cdbce7d6eebc2a9250d214764db945f66650e89 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 31 Dec 2025 15:25:54 +0000 Subject: [PATCH] Improve benchmark output clarity Add explicit summary showing pre-compiled is X times FASTER, and explain that "X slower" in comparison means relative to the fastest option (pre-compiled Ruby). Higher i/s = faster. --- performance/compile_benchmark.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/performance/compile_benchmark.rb b/performance/compile_benchmark.rb index bdc48ea1..29fda696 100644 --- a/performance/compile_benchmark.rb +++ b/performance/compile_benchmark.rb @@ -171,6 +171,19 @@ class CompileBenchmarkRunner puts "=" * 60 puts + # Run quick timing to get approximate values for summary + iterations = 50 + + start = Process.clock_gettime(Process::CLOCK_MONOTONIC) + iterations.times { render_interpreted } + interpreted_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start + + start = Process.clock_gettime(Process::CLOCK_MONOTONIC) + iterations.times { render_compiled } + compiled_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start + + speedup = interpreted_time / compiled_time + Benchmark.ips do |x| x.time = 10 x.warmup = 5 @@ -189,6 +202,16 @@ class CompileBenchmarkRunner x.compare! end + + # Print clear summary + puts + puts "=" * 60 + puts "SUMMARY:" + puts " ✓ Pre-compiled Ruby is #{speedup.round(2)}x FASTER than interpreted Liquid" + puts + puts " (The 'X slower' above means compared to the fastest option," + puts " which is pre-compiled Ruby. Higher i/s = faster.)" + puts "=" * 60 end end