<!DOCTYPE html>
<html data-lt-installed="true">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body style="padding-bottom: 1px;">
    <p>Hi, Sergey,</p>
    <p>thanks for the patch! See my comments.</p>
    <p>Sergey</p>
    <div class="moz-cite-prefix">On 10/24/25 13:50, Sergey Kaplun wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:6afff7d5f3be90f8c346ccbd42db20269cad8c1f.1761301736.git.skaplun@tarantool.org">
      <pre wrap="" class="moz-quote-pre">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-fib.lua | 28 +++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/perf/LuaJIT-benches/recursive-fib.lua b/perf/LuaJIT-benches/recursive-fib.lua
index ef9950de..99af3f9e 100644
--- a/perf/LuaJIT-benches/recursive-fib.lua
+++ b/perf/LuaJIT-benches/recursive-fib.lua
@@ -1,7 +1,31 @@
+local bench = require("bench").new(arg)
+
 local function fib(n)
   if n < 2 then return 1 end
   return fib(n-2) + fib(n-1)
 end
 
-local n = tonumber(arg[1]) or 10
-io.write(string.format("Fib(%d): %d\n", n, fib(n)))</pre>
    </blockquote>
    debug print was lost, is it intentional?
    <blockquote type="cite"
cite="mid:6afff7d5f3be90f8c346ccbd42db20269cad8c1f.1761301736.git.skaplun@tarantool.org">
      <pre wrap="" class="moz-quote-pre">
+local n = tonumber(arg[1]) or 40</pre>
    </blockquote>
    Why 40?
    <blockquote type="cite"
cite="mid:6afff7d5f3be90f8c346ccbd42db20269cad8c1f.1761301736.git.skaplun@tarantool.org">
      <pre wrap="" class="moz-quote-pre">
+
+local benchmark
+benchmark = {
+  name = "recursive_fib",
+  checker = function(res)
+    local km1, k = 1, 1
+    for i = 2, n do
+      local tmp = k + km1
+      km1 = k
+      k = tmp
+    end
+    return k == res
+  end,
+  payload = function()
+    local res = fib(n)
+    -- Number of calls.
+    benchmark.items = res * 2 - 1
+    return res
+  end,
+}
+
+bench:add(benchmark)
+bench:run_and_report()
</pre>
    </blockquote>
  </body>
  <lt-container></lt-container>
</html>