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 725211944AC5; Tue, 13 Jan 2026 18:37:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 725211944AC5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1768318670; bh=IRiJBbrBbKOymSOEUIb2IqiBpNhK27OplfAeR0TUAF8=; 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=S1hTAjlK7QVZJhp1OfoVcoMDDTM1+Hwmw3/Rz51QXMYWW+4gaA+1AkKe9BDt+te1X nFcMTeJ2MnGBSvsOKvCE9893kZZlgHmNJkT+ZapN3fI4VTsbsb5loOEKW7JQDQc7fL f4DQjJaqOOvrLP9Li4F2+WsVe2xxKNJfsTv0SwfI= Received: from send81.i.mail.ru (send81.i.mail.ru [89.221.237.176]) (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 142F01944AD1 for ; Tue, 13 Jan 2026 18:37:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 142F01944AD1 Received: by exim-smtp-7b4fb89df9-dnn8f with esmtpa (envelope-from ) id 1vfgSq-00000000Jqo-04fc; Tue, 13 Jan 2026 18:37:48 +0300 Content-Type: multipart/alternative; boundary="------------xr1Fik3zqVl49f00j0VAnb0l" Message-ID: <72305f51-92c2-4b38-bef3-b045b529e40e@tarantool.org> Date: Tue, 13 Jan 2026 18:37:47 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <6fb711e7-fd3d-4749-a581-e31de35621ac@tarantool.org> In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBD78E5B51DE69E67E134CC12E14949938B182A05F53808504090D8CDCBDFCFB01A3DE06ABAFEAF67058F3D59B7899E9E2BB2CDCC1786F964BC5E5D4A160AC272F4 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AED985C8E545F588EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566DDAE7ACB9D63E4C437F8D025FCC60FF4ECCED3FBA933CCA0ECED7E2D55D8ECD3389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6957A4DEDD2346B42CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249856D39DDE074172D76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B603FFC0BF4CC20A33AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735B58781B77DE60D36C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A58C98695293EFDFDD5002B1117B3ED6960D21CD9E1B12FA33C89B063BDC7FAC35823CB91A9FED034534781492E4B8EEAD5DF1C2DF01CE7211BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659192EDA87342C3B631BA5BBB95542C5032A40E3256C183BEE158AAAFE08F085769422EBB3CBCA325AB8341EE9D5BE9A0A09FE18508F5D819485FBEE584578B6FC3B26FF4E6BAC10A18CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVVt0N+pdRHOZWaa79bMpSrI= X-Mailru-Sender: 811C44EDE0507D1FFB106D83BFFB684FC25F614B4625A4860623C2DC5F880BF93F88756F7F43592DBE5A42202EE99A00645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 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. --------------xr1Fik3zqVl49f00j0VAnb0l Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Thanks! LGTM On 1/3/26 09:28, Sergey Kaplun wrote: > Hi, Sergey! > Fixed your comment. > > On 02.01.26, Sergey Bronnikov wrote: >> Hi, Sergey! >> >> thanks for the patch! LGTM >> >> Sergey >> >> On 12/26/25 12:17, Sergey Kaplun wrote: > > >>> + 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) > Reformatted as you suggested: > > =================================================================== > diff --git a/perf/LuaJIT-benches/revcomp.lua b/perf/LuaJIT-benches/revcomp.lua > index 6e8a7049..1746334b 100644 > --- a/perf/LuaJIT-benches/revcomp.lua > +++ b/perf/LuaJIT-benches/revcomp.lua > @@ -18,7 +18,7 @@ iubc = setmetatable({ > t="A", g="C", v="B", h="D", m="K", y="R", u="A", > N="N", S="S", W="W", n="N", s="S", w="W", > }, { __index = function(t, s) > - local r = t[sub(s, 2)]..t[sub(s, 1, 1)]; t[s] = r; return r end }) > + local r = t[sub(s, 2)] .. t[sub(s, 1, 1)]; t[s] = r; return r end }) > > local stdout = io.output() > > @@ -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() --------------xr1Fik3zqVl49f00j0VAnb0l Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Thanks! LGTM

On 1/3/26 09:28, Sergey Kaplun wrote:
Hi, Sergey!
Fixed your comment.

On 02.01.26, Sergey Bronnikov wrote:
Hi, Sergey!

thanks for the patch! LGTM

Sergey

On 12/26/25 12:17, Sergey Kaplun wrote:
<snipped>

+  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)
Reformatted as you suggested:

===================================================================
diff --git a/perf/LuaJIT-benches/revcomp.lua b/perf/LuaJIT-benches/revcomp.lua
index 6e8a7049..1746334b 100644
--- a/perf/LuaJIT-benches/revcomp.lua
+++ b/perf/LuaJIT-benches/revcomp.lua
@@ -18,7 +18,7 @@ iubc = setmetatable({
   t="A", g="C", v="B", h="D", m="K", y="R", u="A",
   N="N", S="S", W="W", n="N", s="S", w="W",
 }, { __index = function(t, s)
-  local r = t[sub(s, 2)]..t[sub(s, 1, 1)]; t[s] = r; return r end })
+  local r = t[sub(s, 2)] .. t[sub(s, 1, 1)]; t[s] = r; return r end })
 
 local stdout = io.output()
 
@@ -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()

    
--------------xr1Fik3zqVl49f00j0VAnb0l--