From c877da6c1f84b19cd2e7e8154b4a0d0e355745a0 Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Tue, 10 May 2011 21:50:46 +0930 Subject: Suspend the garbage collector during benchmarks Suspending GC appears to make the benchmark results more consistent. --- tests/common.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/common.lua b/tests/common.lua index d712c83..fd0e805 100644 --- a/tests/common.lua +++ b/tests/common.lua @@ -128,12 +128,13 @@ end function benchmark(tests, iter, rep) local function bench(func, iter) - collectgarbage("collect") + collectgarbage("stop") local t = gettimeofday() for i = 1, iter do func(i) end t = gettimeofday() - t + collectgarbage("restart") return (iter / t) end -- cgit v1.2.3-55-g6feb