<!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:f25ba3f8dbeafb2a51db3f6a169453b9f6b3cbb5.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.
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 @@
+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</pre>
</blockquote>
Why 5000 by default?
<blockquote type="cite"
cite="mid:f25ba3f8dbeafb2a51db3f6a169453b9f6b3cbb5.1761301736.git.skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
local RADIX = N < 6500 and 2^36 or 2^32 -- Avoid overflow.
--- Substitute radix and compile chunk.
-local pidigit = loadstring(string.gsub(chunk, "RADIX", tostring(RADIX)))()
+local stdout = io.output()
--- Print lines with 10 digits.
-for i=10,N,10 do
- for j=1,10 do io.write(pidigit()) end
- io.write("\t:", i, "\n")
-end
+bench:add({
+ name = "pidigit_nogmp",
+ -- Avoid skip checking here, since it is not very convenient.
+ -- If you want to check the behaviour -- drop the setup
+ -- function.
+ skip_check = true,
+ setup = function()
+ io.output("/dev/null")
+ end,
+ payload = function()
+ -- Substitute radix and compile chunk.
+ local pidigit = loadstring(string.gsub(chunk, "RADIX", tostring(RADIX)))()
--- Print remaining digits (if any).
-local n10 = N % 10
-if n10 ~= 0 then
- for i=1,n10 do io.write(pidigit()) end</pre>
</blockquote>
add more whitespaces, here and below
<blockquote type="cite"
cite="mid:f25ba3f8dbeafb2a51db3f6a169453b9f6b3cbb5.1761301736.git.skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
- io.write(string.rep(" ", 10-n10), "\t:", N, "\n")
-end
+ -- Print lines with 10 digits.
+ for i=10,N,10 do
+ for j=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")
+ end
+ end,
+ teardown = function()
+ io.output(stdout)
+ end,
+ items = N,
+})
+
+bench:run_and_report()
</pre>
</blockquote>
</body>
<lt-container></lt-container>
</html>