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 4BD5015A8083; Mon, 17 Nov 2025 11:35:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4BD5015A8083 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1763368529; bh=2Ipxp3GKtz8jqBnkMdnzdLN5oOj7T5nyivob5gkpCOU=; 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=w+60X//eo4StuwaYj2Yitqab8sb91FdE/gFyKO0urOCDvGx1tY0YV9Otk8B4vKuOv BmaSP2+2855+JQAqR2db6B21MTxYyWh3R1kJDIDkI/2iTtqLS+iLHY08hY6VzrZd/d D7MvRMA6gI+TxGlBg2UmsqJwhIHGSLeYu0GvBQJc= Received: from send197.i.mail.ru (send197.i.mail.ru [95.163.59.36]) (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 DB38015A8080 for ; Mon, 17 Nov 2025 11:35:26 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DB38015A8080 Received: by exim-smtp-77df68b9cf-95s62 with esmtpa (envelope-from ) id 1vKuhp-00000000EP7-2cYR; Mon, 17 Nov 2025 11:35:26 +0300 Content-Type: multipart/alternative; boundary="------------Romz9BOGulR5b50zqc5qJuVa" Message-ID: Date: Mon, 17 Nov 2025 11:35:21 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <75a84e56bcbe64c8628c40633819b5314129788d.1761301736.git.skaplun@tarantool.org> In-Reply-To: <75a84e56bcbe64c8628c40633819b5314129788d.1761301736.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9110BAFCBE6BD1D167962A216374BA883BE7D91910570A273182A05F5380850402BA0E5E443ACBC793DE06ABAFEAF67058740984E78F771CBB90FB3693C7F7FA445678E5A44F257A1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75263010198C72082EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371D5B197C6EC5B4BE8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2877A5D4E965452B82E070BE324C7D3C43CD22B3396F30B8DF6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249D082881546D93491CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0D9442B0B5983000E8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C0CAB4775CB929E3BB7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B1F41620B44FB51B7DB3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE33AC447995A7AD182BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E7356D8C47C27EEC5E9FB5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A516DE53E325A900315002B1117B3ED696D561BA77A9489530BFF4097FFC9E796F823CB91A9FED034534781492E4B8EEAD2B25D9E4C92BC8ACBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D343DCFC3BEDFB0242D8BA92D4FDCD42DF041AC05FC2A178F8B1EB7C30C75C95C9371EBC24F2AC11F161D7E09C32AA3244CE8F4C427307A379677DD89D51EBB774203A459FD72F74F24EA455F16B58544A2E30DDF7C44BCB90DA5AE236DF995FB59978A700BF655EAEEED6A17656DB59BCAD427812AF56FC65B X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVfFX+FmbwDW1vGDxgC+05hk= X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B599C123638F86AF9D23DE06ABAFEAF67058740984E78F771CBB7CBEF92542CD7C8795FA72BAB74744FC77752E0C033A69EA16A481184E8BB1C9B38E6EA4F046BE03A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 luajit 12/41] perf: adjust life 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. --------------Romz9BOGulR5b50zqc5qJuVa Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Sergey, thanks for the patch! See my comments. Sergey 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 output is redirected to /dev/null. The checker tests the result > after the exact amount of iterations for the fixed field (as it is > declared in the original benchmark). > --- > perf/LuaJIT-benches/life.lua | 79 +++++++++++++++++++++++++++++++++++- > 1 file changed, 78 insertions(+), 1 deletion(-) > > diff --git a/perf/LuaJIT-benches/life.lua b/perf/LuaJIT-benches/life.lua > index 911d9fe1..d0e4dc98 100644 > --- a/perf/LuaJIT-benches/life.lua > +++ b/perf/LuaJIT-benches/life.lua > @@ -3,6 +3,8 @@ > -- modified to use ANSI terminal escape sequences > -- modified to use for instead of while > > +local bench = require('bench').new(arg) > + > local write=io.write > > ALIVE="�" DEAD="�" We usually use ascii only symbols. Should we replace with ascii-only alternative? > @@ -106,6 +108,81 @@ function LIFE(w,h) > if gen>2000 then break end > --delay() -- no delay dead code > end > + return thisgen > end > > -LIFE(40,20) > +-- Result of the LIFE(40, 20) after 2000 generations. > +--[[ > +---------------------------------------- > +---------------------------------------- > +--OO--------------------------O--------- > +-OO--------------------------O-O-------- > +---O--------------------------O--------- > +---------------------------------------- > +---------------------------------------- > +---------------------------------------- > +---------------------------------------- > +---------------------------------------- > +---------------------------------------- > +---------------------------------------- > +---O------------------------------------ > +--O-O----------------------------------- > +--O-O----------------------------------- > +---O------------------------------------ > +---------------------------------------- > +-------OO------------------------------- > +-------OO------------------------------- > +---------------------------------------- > +]] > + > +local function check_life(thisgen, w, h) > + local expected_cells = ARRAY2D(w, h) > + for y = 1, h do > + for x = 1, w do > + expected_cells[y][x] = false > + end > + end > + local alive_cells = { > + {3, 3}, {3, 4}, {3, 31}, > + {4, 2}, {4, 3}, {4, 30}, {4, 32}, > + {5, 4}, {5, 31}, > + {13, 4}, > + {14, 3}, {14, 5}, > + {15, 3}, {15, 5}, > + {16, 4}, > + {18, 8}, {18, 9}, > + {19, 8}, {19, 9}, > + } > + for _, cell in ipairs(alive_cells) do > + local y, x = cell[1], cell[2] > + expected_cells[y][x] = true > + end > + for y = 1, h do > + for x = 1, w do > + assert(thisgen[y][x] > 0 == expected_cells[y][x], > + ('Incorrect value for cell (%d, %d)'):format(x, y)) > + end > + end > + return true > +end > + > +local stdout = io.output() > + > +bench:add({ > + name = 'life', > + setup = function() > + io.output('/dev/null') > + end, > + payload = function() > + return LIFE(40, 20) > + end, > + teardown = function() > + io.output(stdout) > + end, > + checker = function(res) > + return check_life(res, 40, 20) > + end, > + items = 2000 * 40 * 20, > +}) > + > +bench:run_and_report() --------------Romz9BOGulR5b50zqc5qJuVa Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi, Sergey,

thanks for the patch! See my comments.

Sergey

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 output is redirected to /dev/null. The checker tests the result
after the exact amount of iterations for the fixed field (as it is
declared in the original benchmark).
---
 perf/LuaJIT-benches/life.lua | 79 +++++++++++++++++++++++++++++++++++-
 1 file changed, 78 insertions(+), 1 deletion(-)

diff --git a/perf/LuaJIT-benches/life.lua b/perf/LuaJIT-benches/life.lua
index 911d9fe1..d0e4dc98 100644
--- a/perf/LuaJIT-benches/life.lua
+++ b/perf/LuaJIT-benches/life.lua
@@ -3,6 +3,8 @@
 -- modified to use ANSI terminal escape sequences
 -- modified to use for instead of while
 
+local bench = require('bench').new(arg)
+
 local write=io.write
 
 ALIVE="�"	DEAD="�"
We usually use ascii only symbols. Should we replace with ascii-only alternative?
@@ -106,6 +108,81 @@ function LIFE(w,h)
     if gen>2000 then break end
     --delay()		-- no delay
dead code
   end
+  return thisgen
 end
 
-LIFE(40,20)
+-- Result of the LIFE(40, 20) after 2000 generations.
+--[[
+----------------------------------------
+----------------------------------------
+--OO--------------------------O---------
+-OO--------------------------O-O--------
+---O--------------------------O---------
+----------------------------------------
+----------------------------------------
+----------------------------------------
+----------------------------------------
+----------------------------------------
+----------------------------------------
+----------------------------------------
+---O------------------------------------
+--O-O-----------------------------------
+--O-O-----------------------------------
+---O------------------------------------
+----------------------------------------
+-------OO-------------------------------
+-------OO-------------------------------
+----------------------------------------
+]]
+
+local function check_life(thisgen, w, h)
+  local expected_cells = ARRAY2D(w, h)
+  for y = 1, h do
+    for x = 1, w do
+      expected_cells[y][x] = false
+    end
+  end
+  local alive_cells = {
+    {3, 3}, {3, 4}, {3, 31},
+    {4, 2}, {4, 3}, {4, 30}, {4, 32},
+    {5, 4}, {5, 31},
+    {13, 4},
+    {14, 3}, {14, 5},
+    {15, 3}, {15, 5},
+    {16, 4},
+    {18, 8}, {18, 9},
+    {19, 8}, {19, 9},
+  }
+  for _, cell in ipairs(alive_cells) do
+    local y, x = cell[1], cell[2]
+    expected_cells[y][x] = true
+  end
+  for y = 1, h do
+    for x = 1, w do
+      assert(thisgen[y][x] > 0 == expected_cells[y][x],
+             ('Incorrect value for cell (%d, %d)'):format(x, y))
+    end
+  end
+  return true
+end
+
+local stdout = io.output()
+
+bench:add({
+  name = 'life',
+  setup = function()
+    io.output('/dev/null')
+  end,
+  payload = function()
+    return LIFE(40, 20)
+  end,
+  teardown = function()
+    io.output(stdout)
+  end,
+  checker = function(res)
+    return check_life(res, 40, 20)
+  end,
+  items = 2000 * 40 * 20,
+})
+
+bench:run_and_report()
--------------Romz9BOGulR5b50zqc5qJuVa--