From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 41BC71876ECA; Fri, 2 Jan 2026 19:33:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 41BC71876ECA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1767371585; bh=I+4dlHyxWX0XkGW6jOMZJKB2ICqMK94p6sHopFD8sAg=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=akj5+QYhCIjEixK4cewkqVi7JS9oDi0rDFSU87iR1BJv2W4PnpOaY2Tghk8lUJDEP W2rWLAs8nVEJROOjou38Z+s4zglwi8B0eaM9zZAyNNU1FdJzMnNmKfiEkyULWigxa2 EzODaJ1E3qiIGNRv8WDFvayM2YDbDMXJ2+YP4zac= Received: from send240.i.mail.ru (send240.i.mail.ru [95.163.59.79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id F0E6816EC05D for ; Fri, 2 Jan 2026 19:32:41 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F0E6816EC05D Received: by exim-smtp-7b4fb89df9-hkj7m with esmtpa (envelope-from ) id 1vbi4u-000000004lb-3buU; Fri, 02 Jan 2026 19:32:41 +0300 Content-Type: multipart/alternative; boundary="------------V9T7vj075UjqRhUEsqbKK93M" Message-ID: Date: Fri, 2 Jan 2026 19:32:40 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <6db4d7cf747beb36db80a5dc6002f0b45a98073d.1766738771.git.skaplun@tarantool.org> In-Reply-To: <6db4d7cf747beb36db80a5dc6002f0b45a98073d.1766738771.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBD705C26DA7DFA1BE5FABF32B159CC9D93182A05F538085040BACF93BDB7405E643DE06ABAFEAF67054017E9729EDE1A11598BF2F05FED0F13E5BD31BE838A11F7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73C714006C69EB7BAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F88016AB904663428638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2B036AD8A71D162072E070BE324C7D3C4977B88C936F0ED36F6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249D082881546D93491CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0A3E989B1926288338941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C0BCF2C0F5768D5B7A7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B103CEA74F0D118906B3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B53A69B3AC30C7B9475ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5B5CD3A45E005F1AD5002B1117B3ED696FE3178693717EB9F92212597CCBD6D77823CB91A9FED034534781492E4B8EEADAE4FDBF11360AC9BBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659B2A5D851CAA129C64D62BB495F371F17EA15EA99B6C310F7BEC98608D6850F6AB34C71E7A22A6C11B8341EE9D5BE9A0AC39EBC3771DAB212A587073C8F64EF9D85E50813C6B142188CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVTZJppT4ZVHRDAdYsTnjVmg= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F258845881125399BE721981A7CF1FCFAF80C0E98A1EA290D41691823CEE643800BFAC3F645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 35/41] perf: adjust spectral-norm in LuaJIT-benches X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------V9T7vj075UjqRhUEsqbKK93M Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey, thanks for the patch! LGTM Sergey On 12/26/25 12:18, Sergey Kaplun wrote: > This patch adjusts the aforementioned test to use the benchmark > framework introduced before. The default arguments are adjusted > according to the file. The arguments to the script still > can be provided in the command line run. > --- > perf/LuaJIT-benches/spectral-norm.lua | 47 ++++++++++++++++++++------- > 1 file changed, 36 insertions(+), 11 deletions(-) > > diff --git a/perf/LuaJIT-benches/spectral-norm.lua b/perf/LuaJIT-benches/spectral-norm.lua > index ecc80112..7a7712a0 100644 > --- a/perf/LuaJIT-benches/spectral-norm.lua > +++ b/perf/LuaJIT-benches/spectral-norm.lua > @@ -1,3 +1,11 @@ > +-- The benchmark to check the performance of FP arithmetics and > +-- function call inlining in the inner loops. > +-- The benchmark calculates the spectral norm of an infinite > +-- matrix. > +-- For more details see: > +--https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/spectralnorm.html > + > +local bench = require("bench").new(arg) > > local function A(i, j) > local ij = i+j-1 > @@ -25,16 +33,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 > > -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 > > -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 _ = 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() --------------V9T7vj075UjqRhUEsqbKK93M Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey,

thanks for the patch! LGTM

Sergey

On 12/26/25 12:18, 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/spectral-norm.lua | 47 ++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/perf/LuaJIT-benches/spectral-norm.lua b/perf/LuaJIT-benches/spectral-norm.lua
index ecc80112..7a7712a0 100644
--- a/perf/LuaJIT-benches/spectral-norm.lua
+++ b/perf/LuaJIT-benches/spectral-norm.lua
@@ -1,3 +1,11 @@
+-- The benchmark to check the performance of FP arithmetics and
+-- function call inlining in the inner loops.
+-- The benchmark calculates the spectral norm of an infinite
+-- matrix.
+-- For more details see:
+-- https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/spectralnorm.html
+
+local bench = require("bench").new(arg)
 
 local function A(i, j)
   local ij = i+j-1
@@ -25,16 +33,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
 
-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
 
-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 _ = 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()
--------------V9T7vj075UjqRhUEsqbKK93M--