[Tarantool-patches] [PATCH v1 luajit 25/41] perf: adjust recursive-fib in LuaJIT-benches

Sergey Kaplun skaplun at tarantool.org
Fri Dec 26 11:30:40 MSK 2025


Hi, Sergey!
Thanks for the review.
Please, consider my answers below.

On 17.11.25, Sergey Bronnikov wrote:
> Hi, Sergey,
> 
> thanks for the patch! See my comments.
> 
> Sergey
> 
> On 10/24/25 13:50, Sergey Kaplun wrote:
> > 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 @@

Added the comment with the short benchmark description, as we
discussed offline:

===================================================================
diff --git a/perf/LuaJIT-benches/recursive-fib.lua b/perf/LuaJIT-benches/recursive-fib.lua
index 99af3f9e..8e96934a 100644
--- a/perf/LuaJIT-benches/recursive-fib.lua
+++ b/perf/LuaJIT-benches/recursive-fib.lua
@@ -1,3 +1,8 @@
+-- The benchmark to check the performance of recursive calls.
+-- Calculates the Fibonacci values recursively.
+-- For the details see:
+-- http://mathworld.wolfram.com/FibonacciNumber.html
+
 local bench = require("bench").new(arg)
 
 local function fib(n)
===================================================================

> > +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)))
> debug print was lost, is it intentional?

It is not the debug print, but verification of program correctness, also
it prevents DCE by the compilers in the compiled languages.

Here it is tested by the checker function.

> > +local n = tonumber(arg[1]) or 40
> Why 40?

It is the default for x86 arch. I've taken the values from PARAMS_x86,
since this is the most important architecture for the Tarantool, see the
commit message.

> > +

<snipped>

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list