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 845EA16599E5; Tue, 23 Dec 2025 13:38:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 845EA16599E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1766486338; bh=LFf4D3OSFpFjsb59bAIoA0mbZCp2LFY74zzJNbyqb0I=; 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=nkykAGR9KIwPzxtt9gvnDkLRw6ZPu+D7zhpJKA6HMNUXED/wpCMmPTesi61vQ5gxy HR1wBW0FP1LxKUfvI0LjbwQtuUb4GIdOXQPeSv9Q8QaxUfzAvy+BGxVNmvq2w1LO0L pa5inhb1ffTD3iZ/JD5xuSgGcxsjsngKO6nK2Njk= Received: from send172.i.mail.ru (send172.i.mail.ru [95.163.59.11]) (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 6AC1E16599E8 for ; Tue, 23 Dec 2025 13:38:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6AC1E16599E8 Received: by exim-smtp-7b4fb89df9-f7qdb with esmtpa (envelope-from ) id 1vXzmD-0000000046l-2OMS; Tue, 23 Dec 2025 13:38:01 +0300 Content-Type: multipart/alternative; boundary="------------Mmi4W7kwUeO0FLCFrf2OqgNw" Message-ID: <058ce9d7-51d4-4639-9ef1-d64878fb117b@tarantool.org> Date: Tue, 23 Dec 2025 13:38:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9169BA2A4A1D10D0071EB34CDEF2671BC98AFF2FBD86E5187182A05F5380850403B2A8585E6B4FE893DE06ABAFEAF670581F2AAB39AA77B3A6DBB412B9F8581CAFB9BA65748D3C19F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74FF5DF51D335CFFFEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566EF210049E62C3CC540076DA25CC2E30DD146867C1E5D46D75F902C9AACF9218C389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6957A4DEDD2346B42CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249537E5CF43EE7B3DE76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B2B4B37CDEA75E1A13AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE493B89ED3C7A6281781D028CC0B556B22BCC4224003CC83647689D4C264860C145E X-B7AD71C0: 6FEFE4C63DFE2D851629A3278334FCEC2AD323669803AD9FE6E38E9349F0B96634F5427E01161884FBBC670EF8B46CDD X-C1DE0DAB: 0D63561A33F958A5F13ED95C41D547195002B1117B3ED696299B113E07B65B4D1E49B01306B5E3AD823CB91A9FED034534781492E4B8EEAD09F854029C6BD0DABDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34C2AFAD3E4DDF5968D25B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659AEAA977EF019E909E4E044FD2F524E18B86DDB92B0D508ECFD39405209A2ABE80A3E65F58E709D8EB8341EE9D5BE9A0AB97EA432159CE31305CB097BA505BE42CF11D32576EC58FF8CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVdtTL5f5BIXbYRQa6R1RDzQ= X-Mailru-Sender: 811C44EDE0507D1FFB106D83BFFB684FBE88B6E9B9051C66F33F69C7E48EA1FB764DF3BFD27EB626858640B5D44F5E5B645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 luajit 16/41] perf: adjust meteor 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. --------------Mmi4W7kwUeO0FLCFrf2OqgNw Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hello, 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 arguments to the script still can be > provided in the command line run. However, the values greater than the > maximum possible solutions found do not affect the time of execution for > this benchmark. Hence, the number of items to proceed is considered > constant as the maximum possible number of solutions. > --- > perf/LuaJIT-benches/meteor.lua | 46 ++++++++++++++++++++++++++-------- > 1 file changed, 36 insertions(+), 10 deletions(-) > > diff --git a/perf/LuaJIT-benches/meteor.lua b/perf/LuaJIT-benches/meteor.lua > index 80588ab5..f3962820 100644 > --- a/perf/LuaJIT-benches/meteor.lua > +++ b/perf/LuaJIT-benches/meteor.lua > @@ -1,3 +1,4 @@ > +local bench = require("bench").new(arg) > > -- Generate a decision tree based solver for the meteor puzzle. > local function generatesolver(countinit) > @@ -118,6 +119,10 @@ local function printresult() > printboard(smax) > end > > +local function getresult() > + return countinit-count, smin, smax > +end > + > -- Generate piece lookup array from the order of use. > local function genp() > local p = pcs > @@ -141,7 +146,7 @@ local function f91(k) > local s = p[b0] ]] > for p=2,99 do if ok[p] then s = s.."..p[b"..p.."]" end end please add more whitespaces. Here and below. > s = s..[[ > - -- Remember min/max boards, dito for the symmetric board. > + -- Remember min/max boards, ditto for the symmetric board. > if not smin then smin = s; smax = s > elseif s < smin then smin = s elseif s > smax then smax = s end > s = reverse(s) > @@ -206,15 +211,36 @@ local f93 = f91 > end > > -- Compile and return solver function and result getter. > - return loadstring(s.."return f0, printresult\n", "solver")(countinit) > + return loadstring(s.."return f0, printresult, getresult\n", "solver")(countinit) > end > > --- Generate the solver function hierarchy. > -local solver, printresult = generatesolver(tonumber(arg and arg[1]) or 10000) > - > --- The optimizer for LuaJIT 1.1.x is not helpful here, so turn it off. > -if jit and jit.opt and jit.version_num < 10200 then jit.opt.start(0) end > +local N = tonumber(arg and arg[1]) or 10000 > + > +bench:add({ > + name = "meteror", typo: s/meteror/meteor/ > + setup = function() > + -- The optimizer for LuaJIT 1.1.x is not helpful here, so turn it off. > + if jit and jit.opt and jit.version_num < 10200 then jit.opt.start(0) end > + end, > + payload = function() > + -- Generate the solver function hierarchy. > + local solver, printresult, getresult = generatesolver(N) > + > + -- Run the solver protected to get partial results (max count or ctrl-c). > + pcall(solver, 0) > + > + local n, smin, smax = getresult() > + return {n = n, smin = smin, smax = smax} > + end, > + checker = function(res) > + if N >= 2097 then > + assert(res.n == 2098, "Incorrect solutions number") > + assert(res.smin == "00001222012661126155865558633348893448934747977799") > + assert(res.smax == "99998966856688568255777257472014220144031400311333") > + end > + return true > + end, > + items = 2098, > +}) > > --- Run the solver protected to get partial results (max count or ctrl-c). > -pcall(solver, 0) > -printresult() > +bench:run_and_report() --------------Mmi4W7kwUeO0FLCFrf2OqgNw Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hello,

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 arguments to the script still can be
provided in the command line run. However, the values greater than the
maximum possible solutions found do not affect the time of execution for
this benchmark. Hence, the number of items to proceed is considered
constant as the maximum possible number of solutions.
---
 perf/LuaJIT-benches/meteor.lua | 46 ++++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 10 deletions(-)

diff --git a/perf/LuaJIT-benches/meteor.lua b/perf/LuaJIT-benches/meteor.lua
index 80588ab5..f3962820 100644
--- a/perf/LuaJIT-benches/meteor.lua
+++ b/perf/LuaJIT-benches/meteor.lua
@@ -1,3 +1,4 @@
+local bench = require("bench").new(arg)
 
 -- Generate a decision tree based solver for the meteor puzzle.
 local function generatesolver(countinit)
@@ -118,6 +119,10 @@ local function printresult()
   printboard(smax)
 end
 
+local function getresult()
+  return countinit-count, smin, smax
+end
+
 -- Generate piece lookup array from the order of use.
 local function genp()
   local p = pcs
@@ -141,7 +146,7 @@ local function f91(k)
     local s = p[b0] ]]
   for p=2,99 do if ok[p] then s = s.."..p[b"..p.."]" end end
please add more whitespaces. Here and below.
   s = s..[[
-    -- Remember min/max boards, dito for the symmetric board.
+    -- Remember min/max boards, ditto for the symmetric board.
     if not smin then smin = s; smax = s
     elseif s < smin then smin = s elseif s > smax then smax = s end
     s = reverse(s)
@@ -206,15 +211,36 @@ local f93 = f91
   end
 
   -- Compile and return solver function and result getter.
-  return loadstring(s.."return f0, printresult\n", "solver")(countinit)
+  return loadstring(s.."return f0, printresult, getresult\n", "solver")(countinit)
 end
 
--- Generate the solver function hierarchy.
-local solver, printresult = generatesolver(tonumber(arg and arg[1]) or 10000)
-
--- The optimizer for LuaJIT 1.1.x is not helpful here, so turn it off.
-if jit and jit.opt and jit.version_num < 10200 then jit.opt.start(0) end
+local N = tonumber(arg and arg[1]) or 10000
+
+bench:add({
+  name = "meteror",
typo: s/meteror/meteor/
+  setup = function()
+    -- The optimizer for LuaJIT 1.1.x is not helpful here, so turn it off.
+    if jit and jit.opt and jit.version_num < 10200 then jit.opt.start(0) end
+  end,
+  payload = function()
+    -- Generate the solver function hierarchy.
+    local solver, printresult, getresult = generatesolver(N)
+
+    -- Run the solver protected to get partial results (max count or ctrl-c).
+    pcall(solver, 0)
+
+    local n, smin, smax = getresult()
+    return {n = n, smin = smin, smax = smax}
+  end,
+  checker = function(res)
+    if N >= 2097 then
+      assert(res.n == 2098, "Incorrect solutions number")
+      assert(res.smin == "00001222012661126155865558633348893448934747977799")
+      assert(res.smax == "99998966856688568255777257472014220144031400311333")
+    end
+    return true
+  end,
+  items = 2098,
+})
 
--- Run the solver protected to get partial results (max count or ctrl-c).
-pcall(solver, 0)
-printresult()
+bench:run_and_report()
--------------Mmi4W7kwUeO0FLCFrf2OqgNw--