Skip to content

Commit 5cdbce7

Browse files
committed
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.
1 parent 520e86b commit 5cdbce7

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

performance/compile_benchmark.rb

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,19 @@ def run_benchmark
171171
puts "=" * 60
172172
puts
173173

174+
# Run quick timing to get approximate values for summary
175+
iterations = 50
176+
177+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
178+
iterations.times { render_interpreted }
179+
interpreted_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
180+
181+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
182+
iterations.times { render_compiled }
183+
compiled_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
184+
185+
speedup = interpreted_time / compiled_time
186+
174187
Benchmark.ips do |x|
175188
x.time = 10
176189
x.warmup = 5
@@ -189,6 +202,16 @@ def run_benchmark
189202

190203
x.compare!
191204
end
205+
206+
# Print clear summary
207+
puts
208+
puts "=" * 60
209+
puts "SUMMARY:"
210+
puts " ✓ Pre-compiled Ruby is #{speedup.round(2)}x FASTER than interpreted Liquid"
211+
puts
212+
puts " (The 'X slower' above means compared to the fastest option,"
213+
puts " which is pre-compiled Ruby. Higher i/s = faster.)"
214+
puts "=" * 60
192215
end
193216
end
194217

0 commit comments

Comments
 (0)