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 BE24C191B842; Fri, 2 Jan 2026 18:37:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BE24C191B842 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1767368248; bh=YI9Nkn+bMjsuSuZFZw3YKoWbjZ6Y6v+8B10ymOyJzyw=; 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=mBrupKKXkPpIe948qCnFfE+ZIPh3iAjCUAJWCFUMvbTBc/B+GpWpLFtbH6zhel5xz MpmgAauBqhk2THp7/oTFqvFiq7pGEJXCZcwG5/aJyLseCkCZ39eb9XihWGDhCur6xZ j/qpwxvcQJ8tot+DCDwTEujjcvYdiuFIKYgMsPLM= Received: from send241.i.mail.ru (send241.i.mail.ru [95.163.59.80]) (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 ED82E191B841 for ; Fri, 2 Jan 2026 18:37:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ED82E191B841 Received: by exim-smtp-7b4fb89df9-lft7n with esmtpa (envelope-from ) id 1vbhDT-00000000Cvu-07eM; Fri, 02 Jan 2026 18:37:27 +0300 Content-Type: multipart/alternative; boundary="------------K76yUABuRZZmucRMdEYuNOBb" Message-ID: <6fb711e7-fd3d-4749-a581-e31de35621ac@tarantool.org> Date: Fri, 2 Jan 2026 18:37:26 +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: 4F1203BC0FB41BD979975AF0D777FEBD651A111AECFA267DF4E9497E9DD4D3AA182A05F538085040A4972935833B0D5E3DE06ABAFEAF67058BB8C7357008F430DD38990A3BC599A1386F63046B3269FA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F544D30F1A6FA191EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637FE9EFE935CD7C6AE8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B22FB6B33D8AAC69632E070BE324C7D3C48C58E0E78FC1B6DBF6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249957A4DEDD2346B42CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0A29E2F051442AF778941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C0BCF2C0F5768D5B7A7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B103CEA74F0D118906B3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B53A69B3AC30C7B9475ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A506CB183DF408F89B5002B1117B3ED69686BA424D603D5F881BDDAE3D1EA49BEA823CB91A9FED034534781492E4B8EEAD5DF1C2DF01CE7211BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D65901AF3A0F4655EE31109C47DA0A06703424DE85301619B4595CE8E28DA284713381D2D86A76E8CC4BB8341EE9D5BE9A0A260C001F105C4A863C37A33F07B65341F0E1A6DDFA0018FA8CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVTZJppT4ZVHR4kLSPrXg2M8= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F25884587C1B8739B82DCC0D4756507F36A35F4B08D53FB3529E64F111E983127093A8F5645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 26/41] perf: adjust revcomp 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. --------------K76yUABuRZZmucRMdEYuNOBb Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 benchmark input is given by redirecting the corresponding > file generated by the `libs/fasta.lua 5e6`. The output > from the benchmark is redirected to /dev/null. Checks are skipped since > the output is very huge, and it is overkill to store it in the > repository. > --- > perf/LuaJIT-benches/revcomp.lua | 84 +++++++++++++++++++++++---------- > 1 file changed, 59 insertions(+), 25 deletions(-) > > diff --git a/perf/LuaJIT-benches/revcomp.lua b/perf/LuaJIT-benches/revcomp.lua > index 34fe347b..6e8a7049 100644 > --- a/perf/LuaJIT-benches/revcomp.lua > +++ b/perf/LuaJIT-benches/revcomp.lua > @@ -1,3 +1,14 @@ > +-- The benchmark to check the performance of hash table lookups by > +-- constant keys, string manipulations, and read/write > +-- operations. > +-- This benchmark reads the line-by-line a redirected FASTA format > +-- file from stdin, which is generated by the > +-- benchmark, and writes the id, description, and the > +-- reverse-complement sequence in FASTA format to stdout. > +-- For the details see: > +--https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/revcomp.html > + > +local bench = require("bench").new(arg) > > local sub = string.sub > iubc = setmetatable({ > @@ -9,29 +20,52 @@ iubc = setmetatable({ > }, { __index = function(t, s) > local r = t[sub(s, 2)]..t[sub(s, 1, 1)]; t[s] = r; return r end }) > > -local wcode = [=[ > -return function(t, n) > - if n == 1 then return end > - local iubc, sub, write = iubc, string.sub, io.write > - local s = table.concat(t, "", 1, n-1) > - for i=#s-59,1,-60 do > - write(]=] > -for i=59,3,-4 do wcode = wcode.."iubc[sub(s, i+"..(i-3)..", i+"..i..")], " end > -wcode = wcode..[=["\n") > - end > - local r = #s % 60 > - if r ~= 0 then > - for i=r,1,-4 do write(iubc[sub(s, i-3 < 1 and 1 or i-3, i)]) end > - write("\n") > - end > -end > -]=] > -local writerev = loadstring(wcode)() > +local stdout = io.output() > + > +bench:add({ > + name = "revcomp", > + -- The compare with the result output file is inconvenient. > + skip_check = true, > + setup = function() > + io.output("/dev/null") > + end, > + payload = function() > + local wcode = [=[ > + return function(t, n) > + if n == 1 then return end > + local iubc, sub, write = iubc, string.sub, io.write > + local s = table.concat(t, "", 1, n - 1) > + for i = #s - 59, 1, -60 do > + write(]=] > + for i = 59, 3, -4 do > + wcode = wcode.."iubc[sub(s, i + "..(i - 3)..", i + "..i..")], " > + end > + wcode = wcode..[=["\n") > + end > + local r = #s % 60 > + if r ~= 0 then > + for i = r, 1, -4 do write(iubc[sub(s, i - 3 < 1 and 1 or i - 3, i)]) end > + write("\n") > + end > + end > + ]=] could you also apply the patch below with formatting? diff --git a/perf/LuaJIT-benches/revcomp.lua b/perf/LuaJIT-benches/revcomp.lua index 6e8a7049..9050110e 100644 --- a/perf/LuaJIT-benches/revcomp.lua +++ b/perf/LuaJIT-benches/revcomp.lua @@ -38,9 +38,9 @@ bench:add({        for i = #s - 59, 1, -60 do          write(]=]      for i = 59, 3, -4 do -      wcode = wcode.."iubc[sub(s, i + "..(i - 3)..", i + "..i..")], " +      wcode = wcode .. "iubc[sub(s, i + " .. (i - 3) .. ", i + " .. i .. ")], "      end -    wcode = wcode..[=["\n") +    wcode = wcode .. [=["\n")        end        local r = #s % 60        if r ~= 0 then @@ -54,7 +54,10 @@ bench:add({      local t, n = {}, 1      for line in io.lines() do        local c = sub(line, 1, 1) -      if c == ">" then writerev(t, n); io.write(line, "\n"); n = 1 +      if c == ">" then +        writerev(t, n); +        io.write(line, "\n"); +        n = 1        elseif c ~= ";" then t[n] = line; n = n + 1 end      end      writerev(t, n) > + local writerev = loadstring(wcode)() > + > + local t, n = {}, 1 > + for line in io.lines() do > + local c = sub(line, 1, 1) > + if c == ">" then writerev(t, n); io.write(line, "\n"); n = 1 > + elseif c ~= ";" then t[n] = line; n = n + 1 end > + end > + writerev(t, n) > + -- Repeat operation several times. > +io.stdin:seek("set", 0) > + end, > + teardown = function() > + io.output(stdout) > + end, > + -- Amount of symbols in the input file. > + items = 5e6, > +}) > > -local t, n = {}, 1 > -for line in io.lines() do > - local c = sub(line, 1, 1) > - if c == ">" then writerev(t, n); io.write(line, "\n"); n = 1 > - elseif c ~= ";" then t[n] = line; n = n + 1 end > -end > -writerev(t, n) > +bench:run_and_report() --------------K76yUABuRZZmucRMdEYuNOBb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

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 benchmark input is given by redirecting the corresponding
<FASTA_5000000> file generated by the `libs/fasta.lua 5e6`. The output
from the benchmark is redirected to /dev/null. Checks are skipped since
the output is very huge, and it is overkill to store it in the
repository.
---
 perf/LuaJIT-benches/revcomp.lua | 84 +++++++++++++++++++++++----------
 1 file changed, 59 insertions(+), 25 deletions(-)

diff --git a/perf/LuaJIT-benches/revcomp.lua b/perf/LuaJIT-benches/revcomp.lua
index 34fe347b..6e8a7049 100644
--- a/perf/LuaJIT-benches/revcomp.lua
+++ b/perf/LuaJIT-benches/revcomp.lua
@@ -1,3 +1,14 @@
+-- The benchmark to check the performance of hash table lookups by
+-- constant keys, string manipulations, and read/write
+-- operations.
+-- This benchmark reads the line-by-line a redirected FASTA format
+-- file from stdin, which is generated by the <fasta.lua>
+-- benchmark, and writes the id, description, and the
+-- reverse-complement sequence in FASTA format to stdout.
+-- For the details see:
+-- https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/revcomp.html
+
+local bench = require("bench").new(arg)
 
 local sub = string.sub
 iubc = setmetatable({
@@ -9,29 +20,52 @@ iubc = setmetatable({
 }, { __index = function(t, s)
   local r = t[sub(s, 2)]..t[sub(s, 1, 1)]; t[s] = r; return r end })
 
-local wcode = [=[
-return function(t, n)
-  if n == 1 then return end
-  local iubc, sub, write = iubc, string.sub, io.write
-  local s = table.concat(t, "", 1, n-1)
-  for i=#s-59,1,-60 do
-    write(]=]
-for i=59,3,-4 do wcode = wcode.."iubc[sub(s, i+"..(i-3)..", i+"..i..")], " end
-wcode = wcode..[=["\n")
-  end
-  local r = #s % 60
-  if r ~= 0 then
-    for i=r,1,-4 do write(iubc[sub(s, i-3 < 1 and 1 or i-3, i)]) end
-    write("\n")
-  end
-end
-]=]
-local writerev = loadstring(wcode)()
+local stdout = io.output()
+
+bench:add({
+  name = "revcomp",
+  -- The compare with the result output file is inconvenient.
+  skip_check = true,
+  setup = function()
+    io.output("/dev/null")
+  end,
+  payload = function()
+    local wcode = [=[
+    return function(t, n)
+      if n == 1 then return end
+      local iubc, sub, write = iubc, string.sub, io.write
+      local s = table.concat(t, "", 1, n - 1)
+      for i = #s - 59, 1, -60 do
+        write(]=]
+    for i = 59, 3, -4 do
+      wcode = wcode.."iubc[sub(s, i + "..(i - 3)..", i + "..i..")], "
+    end
+    wcode = wcode..[=["\n")
+      end
+      local r = #s % 60
+      if r ~= 0 then
+        for i = r, 1, -4 do write(iubc[sub(s, i - 3 < 1 and 1 or i - 3, i)]) end
+        write("\n")
+      end
+    end
+    ]=]

could you also apply the patch below with formatting?

diff --git a/perf/LuaJIT-benches/revcomp.lua b/perf/LuaJIT-benches/revcomp.lua
index 6e8a7049..9050110e 100644
--- a/perf/LuaJIT-benches/revcomp.lua
+++ b/perf/LuaJIT-benches/revcomp.lua
@@ -38,9 +38,9 @@ bench:add({
       for i = #s - 59, 1, -60 do
         write(]=]
     for i = 59, 3, -4 do
-      wcode = wcode.."iubc[sub(s, i + "..(i - 3)..", i + "..i..")], "
+      wcode = wcode .. "iubc[sub(s, i + " .. (i - 3) .. ", i + " .. i .. ")], "
     end
-    wcode = wcode..[=["\n")
+    wcode = wcode .. [=["\n")
       end
       local r = #s % 60
       if r ~= 0 then
@@ -54,7 +54,10 @@ bench:add({
     local t, n = {}, 1
     for line in io.lines() do
       local c = sub(line, 1, 1)
-      if c == ">" then writerev(t, n); io.write(line, "\n"); n = 1
+      if c == ">" then
+        writerev(t, n);
+        io.write(line, "\n");
+        n = 1
       elseif c ~= ";" then t[n] = line; n = n + 1 end
     end
     writerev(t, n)


+    local writerev = loadstring(wcode)()
+
+    local t, n = {}, 1
+    for line in io.lines() do
+      local c = sub(line, 1, 1)
+      if c == ">" then writerev(t, n); io.write(line, "\n"); n = 1
+      elseif c ~= ";" then t[n] = line; n = n + 1 end
+    end
+    writerev(t, n)
+    -- Repeat operation several times.
+    io.stdin:seek("set", 0)
+  end,
+  teardown = function()
+    io.output(stdout)
+  end,
+  -- Amount of symbols in the input file.
+  items = 5e6,
+})
 
-local t, n = {}, 1
-for line in io.lines() do
-  local c = sub(line, 1, 1)
-  if c == ">" then writerev(t, n); io.write(line, "\n"); n = 1
-  elseif c ~= ";" then t[n] = line; n = n + 1 end
-end
-writerev(t, n)
+bench:run_and_report()
--------------K76yUABuRZZmucRMdEYuNOBb--