[Tarantool-patches] [PATCH v1 luajit 22/41] perf: adjust pidigits-nogmp in LuaJIT-benches

Sergey Kaplun skaplun at tarantool.org
Fri Dec 26 11:27:58 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.
> >
> > The output is redirected to /dev/null. The check is skipped since it is
> > very inconvenient to store the huge file in the repository with the
> > reference value.
> > ---
> >   perf/LuaJIT-benches/pidigits-nogmp.lua | 49 ++++++++++++++++++--------
> >   1 file changed, 35 insertions(+), 14 deletions(-)
> >
> > diff --git a/perf/LuaJIT-benches/pidigits-nogmp.lua b/perf/LuaJIT-benches/pidigits-nogmp.lua
> > index 63a1cb0e..e96b3e45 100644
> > --- a/perf/LuaJIT-benches/pidigits-nogmp.lua
> > +++ b/perf/LuaJIT-benches/pidigits-nogmp.lua
> > @@ -1,3 +1,4 @@

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

===================================================================
diff --git a/perf/LuaJIT-benches/pidigits-nogmp.lua b/perf/LuaJIT-benches/pidigits-nogmp.lua
index 3581a55a..cdfa7fcb 100644
--- a/perf/LuaJIT-benches/pidigits-nogmp.lua
+++ b/perf/LuaJIT-benches/pidigits-nogmp.lua
@@ -1,3 +1,10 @@
+-- The benchmark to check the performance of arithmetic operations
+-- array accesses simulating the multi-precision number
+-- operations and the streaming output to the stdout. This
+-- benchmark calculates the first numbers of Pi.
+-- For the details see:
+-- https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/pidigits.html
+
 local bench = require("bench").new(arg)
 
 -- Start of dynamically compiled chunk.
===================================================================

> > +local bench = require("bench").new(arg)
> >   
> >   -- Start of dynamically compiled chunk.
> >   local chunk = [=[
> > @@ -80,21 +81,41 @@ end)
> >   
> >   ]=] -- End of dynamically compiled chunk.
> >   
> > -local N = tonumber(arg and arg[1]) or 27
> > +local N = tonumber(arg and arg[1]) or 5000
> Why 5000 by default?

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.

> >   local RADIX = N < 6500 and 2^36 or 2^32 -- Avoid overflow.
> >   

<snipped>

> > --- Print remaining digits (if any).
> > -local n10 = N % 10
> > -if n10 ~= 0 then
> > -  for i=1,n10 do io.write(pidigit()) end
> add more whitespaces, here and below

Fixed:

===================================================================
diff --git a/perf/LuaJIT-benches/pidigits-nogmp.lua b/perf/LuaJIT-benches/pidigits-nogmp.lua
index e96b3e45..3581a55a 100644
--- a/perf/LuaJIT-benches/pidigits-nogmp.lua
+++ b/perf/LuaJIT-benches/pidigits-nogmp.lua
@@ -100,16 +100,16 @@ bench:add({
     local pidigit = loadstring(string.gsub(chunk, "RADIX", tostring(RADIX)))()
 
     -- Print lines with 10 digits.
-    for i=10,N,10 do
-      for j=1,10 do io.write(pidigit()) end
+    for i = 10, N, 10 do
+      for _ = 1, 10 do io.write(pidigit()) end
       io.write("\t:", i, "\n")
     end
 
     -- Print remaining digits (if any).
     local n10 = N % 10
     if n10 ~= 0 then
-      for i=1,n10 do io.write(pidigit()) end
-      io.write(string.rep(" ", 10-n10), "\t:", N, "\n")
+      for _ = 1, n10 do io.write(pidigit()) end
+      io.write(string.rep(" ", 10 - n10), "\t:", N, "\n")
     end
   end,
   teardown = function()
===================================================================

> > -  io.write(string.rep(" ", 10-n10), "\t:", N, "\n")
> > -end

<snipped>

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list