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 932BC1635492; Thu, 13 Nov 2025 14:07:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 932BC1635492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1763032028; bh=bF5C4TbnSfc3aishP4Ehrr5lVSdtAezZCATfbGLhRXU=; 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=TfhiAciO/w8yeO4xixH3l3UzDbse4R8tf+ZfQVZuWXNGaY5l+hp0nlJ5SU3sgsTrp fsN/1Z9bj1fKpbBOYNKsItaiD2VJpP/fHJi4DMNEV5+PM+XTMdwDp05IVclhEZYC2U JU7QL2luYO6e1Ih3rVZO8n8vg8VH72ma9pOGzSjk= Received: from send242.i.mail.ru (send242.i.mail.ru [95.163.59.81]) (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 1539F1635494 for ; Thu, 13 Nov 2025 14:06:42 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1539F1635494 Received: by exim-smtp-68c8686b96-vlhkh with esmtpa (envelope-from ) id 1vJVA1-000000006O7-0C1r; Thu, 13 Nov 2025 14:06:41 +0300 Content-Type: multipart/alternative; boundary="------------01RP4Y9jWetR7OavrXsOeJzf" Message-ID: Date: Thu, 13 Nov 2025 14:06:40 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <7bed01339e183b7e57bda18130a61748b332c8d0.1761301736.git.skaplun@tarantool.org> In-Reply-To: <7bed01339e183b7e57bda18130a61748b332c8d0.1761301736.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD91EA16F962BF6182EEB5C6970ECF69BAFCBFA99BA5A6A2FF3182A05F538085040E43D203177295D363DE06ABAFEAF6705E55C2D8CAB878C24F2B21125DCCB39B1D2B9C3C88B730D5B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE72AC9FB60380F23AEEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F88016AB904663428638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2A98A0536941ADBF52E070BE324C7D3C4D4EE7F60EA2B13D5F6B57BC7E64490618DEB871D839B73339E8FC8737B5C22498424CA1AAF98A6958941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B64854413538E1713FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C224958C1606C78F2434E76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B6A4E49BB0F3BA1413AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73589424AA0EF8DE9BAC4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A58B09E93F7F2932145002B1117B3ED6967F0FB1C14DB221976E5F408120975D33823CB91A9FED034534781492E4B8EEAD09F854029C6BD0DABDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF91BD1A7608D3AC95E87A115727FC9A99AD6051337709D42050A981C1666C58483D4CAFFB26F46A3DD57337E961690FE28497B7B1D62501E65C23B807FB6C7183EB33E6E83683D183111DC66A97D0BFE2913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVfFX+FmbwDW1rgDEIK7Hmc0= X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B59B3912439E650C0B03DE06ABAFEAF6705E55C2D8CAB878C24B7CBEF92542CD7C8795FA72BAB74744FC77752E0C033A69EA16A481184E8BB1C9B38E6EA4F046BE03A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 luajit 04/41] perf: adjust array3d 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. --------------01RP4Y9jWetR7OavrXsOeJzf Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Sergey! thanks for the patch! On 10/24/25 13:50, 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 number of iterations is fixed for this test to avoid OOM errors > for the non-GC64 builds. > --- > perf/LuaJIT-benches/array3d.lua | 25 ++++++++++++++++++++----- > 1 file changed, 20 insertions(+), 5 deletions(-) > > diff --git a/perf/LuaJIT-benches/array3d.lua b/perf/LuaJIT-benches/array3d.lua > index c10b09b1..75ab5b01 100644 > --- a/perf/LuaJIT-benches/array3d.lua > +++ b/perf/LuaJIT-benches/array3d.lua > @@ -1,3 +1,4 @@ > +local bench = require("bench").new(arg) > > local function array_set(self, x, y, z, p) > assert(x >= 0 and x < self.nx, "x outside PA") > @@ -50,10 +51,24 @@ end > > local dim = tonumber(arg and arg[1]) or 300 -- Array dimension dim^3 > local packed = arg and arg[2] == "packed" -- Packed image or flat > -local arr = array_new(dim, dim, dim, packed) > > -for x,y,z inarr:points() do > -arr:set(x, y, z, x*x) > -end > -assert(arr.image[dim^3-1] == (dim-1)^2) > +bench:add({ > + name = "array3d", > + checker = function(arr) > + assert(arr.image[dim^3-1] == (dim-1)^2) > + return true > + end, > + payload = function() > + local arr = array_new(dim, dim, dim, packed) > + for x,y,z inarr:points() do please add whitespaces after commas > +arr:set(x, y, z, x*x) > + end > + return arr > + end, > + items = dim * dim * dim, > + -- Limit the number of iterations to avoid OOM errors for > + -- non-GC64 builds. > + iterations = 5, > +}) > > +bench:run_and_report() Looks like benchmark min time does not work as expected: [1] ~/sources/MRG/tarantool/third_party/luajit $ time ./build/src/luajit perf/LuaJIT-benches/array3d.lua --benchmark_min_time=10 ------------------------------------------------------------------------------------------------------------- Benchmark                                     Time  CPU    Iterations UserCounters... ------------------------------------------------------------------------------------------------------------- array3d                                     2.10 s          2.13 s             5 items_per_second=64.370M/s real    0m2.333s user    0m1.869s sys     0m0.461s [1] ~/sources/MRG/tarantool/third_party/luajit $ --benchmark_min_time set to 10 sec, but benchmark.lua reports "2.10 s" and time reported by `time` utility is less than 10 sec. --------------01RP4Y9jWetR7OavrXsOeJzf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi, Sergey!

thanks for the patch!

On 10/24/25 13:50, 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 number of iterations is fixed for this test to avoid OOM errors
for the non-GC64 builds.
---
 perf/LuaJIT-benches/array3d.lua | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/perf/LuaJIT-benches/array3d.lua b/perf/LuaJIT-benches/array3d.lua
index c10b09b1..75ab5b01 100644
--- a/perf/LuaJIT-benches/array3d.lua
+++ b/perf/LuaJIT-benches/array3d.lua
@@ -1,3 +1,4 @@
+local bench = require("bench").new(arg)
 
 local function array_set(self, x, y, z, p)
   assert(x >= 0 and x < self.nx, "x outside PA")
@@ -50,10 +51,24 @@ end
 
 local dim = tonumber(arg and arg[1]) or 300 -- Array dimension dim^3
 local packed = arg and arg[2] == "packed"   -- Packed image or flat
-local arr = array_new(dim, dim, dim, packed)
 
-for x,y,z in arr:points() do
-  arr:set(x, y, z, x*x)
-end
-assert(arr.image[dim^3-1] == (dim-1)^2)
+bench:add({
+  name = "array3d",
+  checker = function(arr)
+    assert(arr.image[dim^3-1] == (dim-1)^2)
+    return true
+  end,
+  payload = function()
+    local arr = array_new(dim, dim, dim, packed)
+    for x,y,z in arr:points() do
please add whitespaces after commas
+      arr:set(x, y, z, x*x)
+    end
+    return arr
+  end,
+  items = dim * dim * dim,
+  -- Limit the number of iterations to avoid OOM errors for
+  -- non-GC64 builds.
+  iterations = 5,
+})
 
+bench:run_and_report()

Looks like benchmark min time does not work as expected:

[1] ~/sources/MRG/tarantool/third_party/luajit $ time ./build/src/luajit perf/LuaJIT-benches/array3d.lua --benchmark_min_time=10 
-------------------------------------------------------------------------------------------------------------
Benchmark                                     Time             CPU    Iterations UserCounters...             
-------------------------------------------------------------------------------------------------------------
array3d                                     2.10 s          2.13 s             5 items_per_second=64.370M/s

real    0m2.333s
user    0m1.869s
sys     0m0.461s
[1] ~/sources/MRG/tarantool/third_party/luajit $ 

--benchmark_min_time set to 10 sec, but benchmark.lua reports "2.10 s" and time reported by `time` utility

is less than 10 sec.


    
--------------01RP4Y9jWetR7OavrXsOeJzf--