Skip to content

Commit 2730c25

Browse files
committed
Exit exbench.lua right away if the user attempts to run it directly.
1 parent 0fb6ccd commit 2730c25

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

demo/extra/exbench.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
if not LIB then print("Please run bench.lua from the same working directory instead") return end
2+
13
local function benchmark_md5sum()
2-
local it, s = 5, pcall(require, "md5sum")
4+
local it, s = 2, pcall(require, "md5sum")
35
local bm = BenchmarkStart("Checksum MD5", it)
46
local file = io.open(arg[0], "rb")
57

@@ -18,7 +20,7 @@ local function benchmark_md5sum()
1820
end
1921

2022
local function benchmark_sha256()
21-
local it, s = 5, pcall(require, "s256sum")
23+
local it, s = 1, pcall(require, "s256sum")
2224
local bm = BenchmarkStart("Checksum SHA256", it)
2325
local file = io.open(arg[0], "rb")
2426

@@ -36,6 +38,5 @@ local function benchmark_sha256()
3638
BenchmarkEnd(bm)
3739
end
3840

39-
LIB = true
4041
benchmark_md5sum()
4142
benchmark_sha256()

demo/minimum/bench.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ benchmark_div()
164164
benchmark_pi()
165165
benchmark_gcd()
166166
benchmark_array()
167+
168+
LIB = true
167169
pcall(require, "exbench") -- Optionally run extended benchmarks
168170

169171
-- Print memory and total time summary at the end of the table

0 commit comments

Comments
 (0)