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 A9A4016D4562; Fri, 2 Jan 2026 14:08:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A9A4016D4562 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1767352108; bh=o4fVhov+eZavU+E0vaWFnFvFschfZmU5XHMEyilnSPA=; 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=BFCBSnUqU9v2N/e+qPhfOSVd4iVnyUgC4t606gcg4Ynq1a26YsrdazkYHH8+bwCV/ JdwVNtYDHx3DN/E/AW09mBgxDILsU1Iep5MywjWqBHcZ6fw2p+ycNIJkHOQUuC9/8c boMUSdV+i89tFkIaqLL1YO9N2dIZY6DgFGVRHouY= 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 52F3816D456E for ; Fri, 2 Jan 2026 14:08:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 52F3816D456E Received: by exim-smtp-7b4fb89df9-xrx2b with esmtpa (envelope-from ) id 1vbd19-00000000Hkc-1gu8; Fri, 02 Jan 2026 14:08:27 +0300 Content-Type: multipart/alternative; boundary="------------v0QXkyUG1R4ipyIeBiOkvdb0" Message-ID: <82524604-4cd2-42cc-a1c7-56f080d805d2@tarantool.org> Date: Fri, 2 Jan 2026 14:08:26 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <6250686d102f69ae25d85f179a8d96832a35e35a.1766738771.git.skaplun@tarantool.org> In-Reply-To: <6250686d102f69ae25d85f179a8d96832a35e35a.1766738771.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBD651A111AECFA267DF4E9497E9DD4D3AA182A05F538085040D85CE644DF0AF7353DE06ABAFEAF6705E57AECC2072A96E1EDAA4A20A7B89FD0AD9004C0C8813145 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BF6702EC5472AA0FEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566D1B0EEF93386A5FDE0BE2E0860982293D2322A46FA907D3EA465D225EB4FFF27389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6957A4DEDD2346B42CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C22490F250D17497FEF6176E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B8DBB596EC94336063AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73525A4AB119743A3B3C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A58D037A20CE8ED9965002B1117B3ED69624EF86AF8397E218957033528158102E823CB91A9FED034534781492E4B8EEADA91A6E18C88C5E2F X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659544F24F4470A470848788C40ABD8D69F94D4F017DBE4DBC1615221580B96041C72B5DEB394594D14B8341EE9D5BE9A0A7BD63F3A3E38CA790CFC4BEAAFDFC29504C6C329B65830B68CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVTZJppT4ZVHRHJpJ5AHDrqw= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F2588458CAED63E987BD6A8AD77739F4E260083E830E9D02DCE1EBC2558ADF16E3315EBF645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 23/41] perf: adjust ray 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. --------------v0QXkyUG1R4ipyIeBiOkvdb0 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:17, 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. > > The output is redirected to /dev/null. The check is skipped since it is > very inconvenient to check the binary output, especially since it may be > configured by the parameter. > --- > perf/LuaJIT-benches/ray.lua | 83 +++++++++++++++++++++++++------------ > 1 file changed, 57 insertions(+), 26 deletions(-) > > diff --git a/perf/LuaJIT-benches/ray.lua b/perf/LuaJIT-benches/ray.lua > index 2acc24c0..f322b023 100644 > --- a/perf/LuaJIT-benches/ray.lua > +++ b/perf/LuaJIT-benches/ray.lua > @@ -1,10 +1,12 @@ > +-- Benchmark to check the performance of FP arithmetics and > +-- structure accesses via modeling of ray tracing. The benchmark > +-- generates the fractal image of spheres in the PGM format. > + > +local bench = require("bench").new(arg) > + > local sqrt = math.sqrt > local huge = math.huge > - > -local delta = 1 > -while delta * delta + 1 ~= 1 do > - delta = delta * 0.5 > -end > +local delta > > local function length(x, y, z) return sqrt(x*x + y*y + z*z) end > local function vlen(v) return length(v[1], v[2], v[3]) end > @@ -110,26 +112,55 @@ end > > > local level, n, ss = tonumber(arg[1]) or 9, tonumber(arg[2]) or 256, 4 > -local iss = 1/ss > -local gf = 255/(ss*ss) > - > -io.write(("P5\n%d %d\n255\n"):format(n, n)) > -local light = { unitise(-1, -3, 2) } > -ilight = { -light[1], -light[2], -light[3] } > -local camera = { 0, 0, -4 } > -local dir = { 0, 0, 0 } > - > -local scene = create(level, {0, -1, 0}, 1) > - > -for y = n/2-1, -n/2, -1 do > - for x = -n/2, n/2-1 do > - local g = 0 > - for d = y, y+.99, iss do > - for e = x, x+.99, iss do > - dir[1], dir[2], dir[3] = unitise(e, d, n) > - g = g + ray_trace(light, camera, dir, scene) > + > +local stdout = io.output() > + > +bench:add({ > + name = "ray", > + -- 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() > + -- Cache to avoid upvalue lookups. > + local level, n, ss = level, n, ss > + > + local iss = 1 / ss > + local gf = 255 / (ss * ss) > + > + delta = 1 > + while delta * delta + 1 ~= 1 do > + delta = delta * 0.5 > + end > + > + io.write(("P5\n%d %d\n255\n"):format(n, n)) > + local light = { unitise(-1, -3, 2) } > + ilight = { -light[1], -light[2], -light[3] } > + local camera = { 0, 0, -4 } > + local dir = { 0, 0, 0 } > + > + local scene = create(level, {0, -1, 0}, 1) > + > + for y = n / 2 - 1, -n / 2, -1 do > + for x = -n / 2, n / 2 - 1 do > + local g = 0 > + for d = y, y + .99, iss do > + for e = x, x + .99, iss do > + dir[1], dir[2], dir[3] = unitise(e, d, n) > + g = g + ray_trace(light, camera, dir, scene) > + end > + end > + io.write(string.char(math.floor(0.5 + g * gf))) > end > end > - io.write(string.char(math.floor(0.5 + g*gf))) > - end > -end > + end, > + teardown = function() > + io.output(stdout) > + end, > + items = n * n * level, > +}) > + > +bench:run_and_report() --------------v0QXkyUG1R4ipyIeBiOkvdb0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey!

thanks for the patch! LGTM

Sergey

On 12/26/25 12:17, 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 check the binary output, especially since it may be
configured by the parameter.
---
 perf/LuaJIT-benches/ray.lua | 83 +++++++++++++++++++++++++------------
 1 file changed, 57 insertions(+), 26 deletions(-)

diff --git a/perf/LuaJIT-benches/ray.lua b/perf/LuaJIT-benches/ray.lua
index 2acc24c0..f322b023 100644
--- a/perf/LuaJIT-benches/ray.lua
+++ b/perf/LuaJIT-benches/ray.lua
@@ -1,10 +1,12 @@
+-- Benchmark to check the performance of FP arithmetics and
+-- structure accesses via modeling of ray tracing. The benchmark
+-- generates the fractal image of spheres in the PGM format.
+
+local bench = require("bench").new(arg)
+
 local sqrt = math.sqrt
 local huge = math.huge
-
-local delta = 1
-while delta * delta + 1 ~= 1 do
-  delta = delta * 0.5
-end
+local delta
 
 local function length(x, y, z)  return sqrt(x*x + y*y + z*z) end
 local function vlen(v)          return length(v[1], v[2], v[3]) end
@@ -110,26 +112,55 @@ end
 
 
 local level, n, ss = tonumber(arg[1]) or 9, tonumber(arg[2]) or 256, 4
-local iss = 1/ss
-local gf = 255/(ss*ss)
-
-io.write(("P5\n%d %d\n255\n"):format(n, n))
-local light = { unitise(-1, -3, 2) }
-ilight = { -light[1], -light[2], -light[3] }
-local camera = { 0, 0, -4 }
-local dir = { 0, 0, 0 }
-
-local scene = create(level, {0, -1, 0}, 1)
-
-for y = n/2-1, -n/2, -1 do
-  for x = -n/2, n/2-1 do
-    local g = 0
-    for d = y, y+.99, iss do
-      for e = x, x+.99, iss do
-        dir[1], dir[2], dir[3] = unitise(e, d, n)
-        g = g + ray_trace(light, camera, dir, scene) 
+
+local stdout = io.output()
+
+bench:add({
+  name = "ray",
+  -- 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()
+    -- Cache to avoid upvalue lookups.
+    local level, n, ss = level, n, ss
+
+    local iss = 1 / ss
+    local gf = 255 / (ss * ss)
+
+    delta = 1
+    while delta * delta + 1 ~= 1 do
+      delta = delta * 0.5
+    end
+
+    io.write(("P5\n%d %d\n255\n"):format(n, n))
+    local light = { unitise(-1, -3, 2) }
+    ilight = { -light[1], -light[2], -light[3] }
+    local camera = { 0, 0, -4 }
+    local dir = { 0, 0, 0 }
+
+    local scene = create(level, {0, -1, 0}, 1)
+
+    for y = n / 2 - 1, -n / 2, -1 do
+      for x = -n / 2, n / 2 - 1 do
+        local g = 0
+        for d = y, y + .99, iss do
+          for e = x, x + .99, iss do
+            dir[1], dir[2], dir[3] = unitise(e, d, n)
+            g = g + ray_trace(light, camera, dir, scene)
+          end
+        end
+        io.write(string.char(math.floor(0.5 + g * gf)))
       end
     end
-    io.write(string.char(math.floor(0.5 + g*gf)))
-  end
-end
+  end,
+  teardown = function()
+    io.output(stdout)
+  end,
+  items = n * n * level,
+})
+
+bench:run_and_report()
--------------v0QXkyUG1R4ipyIeBiOkvdb0--