Hi, Sergey,
thanks for the patch! LGTM
Sergey
This patch adjusts the aforementioned test to use the benchmark
framework introduced before. The default arguments are adjusted
according to the <PARAM_x86.txt> file. The arguments to the script still
can be provided in the command line run.
---
perf/LuaJIT-benches/recursive-ack.lua | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/perf/LuaJIT-benches/recursive-ack.lua b/perf/LuaJIT-benches/recursive-ack.lua
index fad30589..1172d4b3 100644
--- a/perf/LuaJIT-benches/recursive-ack.lua
+++ b/perf/LuaJIT-benches/recursive-ack.lua
@@ -1,3 +1,5 @@
+local bench = require("bench").new(arg)
+
local function Ack(m, n)
if m == 0 then return n+1 end
if n == 0 then return Ack(m-1, 1) end
@@ -5,4 +7,17 @@ local function Ack(m, n)
end
local N = tonumber(arg and arg[1]) or 10
-io.write("Ack(3,", N ,"): ", Ack(3,N), "\n")
+
+bench:add({
+ name = "recursive_ack",
+ -- Sum of calls for the function RA(3, N).
+ items = 128 * ((4 ^ N - 1) / 3) - 40 * (2 ^ N - 1) + 3 * N + 15,
+ payload = function()
+ return Ack(3, N)
+ end,
+ checker = function(res)
+ return res == 2 ^ (N + 3) - 3
+ end,
+})
+
+bench:run_and_report()