<!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!</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:32f0c04e390b756cae707eb3476a70f31b255357.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/nsieve-bit.lua | 35 +++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/perf/LuaJIT-benches/nsieve-bit.lua b/perf/LuaJIT-benches/nsieve-bit.lua
index 820a3726..4858e9e2 100644
--- a/perf/LuaJIT-benches/nsieve-bit.lua
+++ b/perf/LuaJIT-benches/nsieve-bit.lua
@@ -1,3 +1,4 @@
+local bench = require("bench").new(arg)
local bit = require("bit")
local band, bxor, rshift, rol = bit.band, bit.bxor, bit.rshift, bit.rol
@@ -17,11 +18,35 @@ local function nsieve(p, m)
return count
end
-local N = tonumber(arg and arg[1]) or 1
+local DEFAULT_N = 12</pre>
</blockquote>
Why 12?
<blockquote type="cite"
cite="mid:32f0c04e390b756cae707eb3476a70f31b255357.1761301736.git.skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
+local N = tonumber(arg and arg[1]) or DEFAULT_N
if N < 2 then N = 2 end
local primes = {}
-for i=0,2 do</pre>
</blockquote>
add more whitespaces, here and below
<blockquote type="cite"
cite="mid:32f0c04e390b756cae707eb3476a70f31b255357.1761301736.git.skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
- local m = (2^(N-i))*10000
- io.write(string.format("Primes up to %8d %8d\n", m, nsieve(primes, m)))</pre>
</blockquote>
io.write is lost, is it intentional?
<blockquote type="cite"
cite="mid:32f0c04e390b756cae707eb3476a70f31b255357.1761301736.git.skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
-end
+local benchmark
+benchmark = {
+ name = "nsieve_bit",
+ payload = function()
+ local res = {}
+ local items = 0
+ for i=0,2 do
+ local m = (2^(N-i))*10000</pre>
</blockquote>
add more whitespaces
<blockquote type="cite"
cite="mid:32f0c04e390b756cae707eb3476a70f31b255357.1761301736.git.skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
+ items = items + m
+ res[i] = nsieve(primes, m)
+ end
+ benchmark.items = items
+
+ return res
+ end,
+ checker = function(res)
+ if N == DEFAULT_N then
+ assert(res[0] == 2488465)
+ assert(res[1] == 1299069)
+ assert(res[2] == 679461)
+ end
+ return true
+ end,
+}
+
+bench:add(benchmark)
+bench:run_and_report()
</pre>
</blockquote>
</body>
<lt-container></lt-container>
</html>