Skip to content

Commit f14b508

Browse files
committed
Add optional execution of extended benchmarks
This change introduces a safe way to load and run extended benchmarks by using `pcall` with `require`. It ensures the main benchmarks remain unaffected if the extended module is unavailable or causes an error. This is perfect for omitting more complicated benchmarks from the 160k diskette version and also demonstrates how pcall can be used to load Lua modules even on operating systems that don't traditionally have linking libraries.
1 parent 51fcf35 commit f14b508

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

demo/minimum/bench.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ benchmark_div()
164164
benchmark_pi()
165165
benchmark_gcd()
166166
benchmark_array()
167+
pcall(require, "exbench") -- Optionally run extended benchmarks
167168

168169
-- Print memory and total time summary at the end of the table
169170
PrintLine()

0 commit comments

Comments
 (0)