<!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 below.</p>
<p>Sergey</p>
<div class="moz-cite-prefix">On 10/24/25 14:00, Sergey Kaplun wrote:<br>
</div>
<blockquote type="cite"
cite="mid:800b8e4d42b3d8f51ad2a5686799004b09e0e719.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/spectral-norm.lua | 40 +++++++++++++++++++--------
1 file changed, 29 insertions(+), 11 deletions(-)
diff --git a/perf/LuaJIT-benches/spectral-norm.lua b/perf/LuaJIT-benches/spectral-norm.lua
index ecc80112..6e63cd47 100644
--- a/perf/LuaJIT-benches/spectral-norm.lua
+++ b/perf/LuaJIT-benches/spectral-norm.lua
@@ -1,3 +1,4 @@
+local bench = require("bench").new(arg)
local function A(i, j)
local ij = i+j-1
@@ -25,16 +26,33 @@ local function AtAv(x, y, t, N)
Atv(t, y, N)
end
-local N = tonumber(arg and arg[1]) or 100
-local u, v, t = {}, {}, {}
-for i=1,N do u[i] = 1 end
+local N = tonumber(arg and arg[1]) or 3000</pre>
</blockquote>
Why it was changed to 3000?
<blockquote type="cite"
cite="mid:800b8e4d42b3d8f51ad2a5686799004b09e0e719.1761301736.git.skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
-for i=1,10 do AtAv(u, v, t, N) AtAv(v, u, t, N) end
+bench:add({
+ name = "spectral_norm",
+ checker = function(res)
+ -- XXX: Empirical value.
+ if N > 66 then
+ assert(math.abs(res - 1.27422) < 0.00001)
+ end
+ return true
+ end,
+ payload = function()
+ local u, v, t = {}, {}, {}
+ for i=1,N do u[i] = 1 end</pre>
</blockquote>
add more whitespaces, here and below
<blockquote type="cite"
cite="mid:800b8e4d42b3d8f51ad2a5686799004b09e0e719.1761301736.git.skaplun@tarantool.org">
<pre wrap="" class="moz-quote-pre">
-local vBv, vv = 0, 0
-for i=1,N do
- local ui, vi = u[i], v[i]
- vBv = vBv + ui*vi
- vv = vv + vi*vi
-end
-io.write(string.format("%0.9f\n", math.sqrt(vBv / vv)))
+ for i=1,10 do AtAv(u, v, t, N) AtAv(v, u, t, N) end
+
+ local vBv, vv = 0, 0
+ for i=1,N do
+ local ui, vi = u[i], v[i]
+ vBv = vBv + ui*vi
+ vv = vv + vi*vi
+ end
+ return math.sqrt(vBv / vv)
+ end,
+ -- Operations inside `for i=1,10` loop.
+ items = 40 * N * N,
+})
+
+bench:run_and_report()
</pre>
</blockquote>
</body>
<lt-container></lt-container>
</html>