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 6716C16D2277; Fri, 2 Jan 2026 13:12:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6716C16D2277 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1767348763; bh=TMbfMvr7ruxZ08sUDXf1Mj86mL47aLcqbUGKvD6SEgw=; 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=eJdpnmArc0p/l8qibFEO6trvWjeQQErqH8HtCIJWBl4x+gNi74YzQDBDV3Iu23MIi pSPUZPi+f3+wMV4icYxom8r6ecJ62dEZPwhQj5uAJvRcadBhbficeNUY54a9qiEQlm bkdGs90Z2JDvG6GuDejsb+XiLO6gzRhNpDOaKOJE= 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 2A1B916D2258 for ; Fri, 2 Jan 2026 13:12:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2A1B916D2258 Received: by exim-smtp-7b4fb89df9-wdkm4 with esmtpa (envelope-from ) id 1vbc9C-00000000OV0-0jnN; Fri, 02 Jan 2026 13:12:42 +0300 Content-Type: multipart/alternative; boundary="------------ZIj6Q9J8UuqtsinPpVirVvMH" Message-ID: Date: Fri, 2 Jan 2026 13:12:41 +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: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBD74B261A13C49CF1ECC4C442725D8AB97182A05F538085040A3DF2A9EECF92EAB3DE06ABAFEAF67053529F43E65D2E7047C6D7116AD809442459A72DE8AD892F7 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE73870E1FF9A049D91EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566D1B0EEF93386A5FD0EB9B29F7EE7B25A37A405FB28112DBA0E720CBDF3022865389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B64854413538E1713FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249AFDCF772572DCC8A76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8BFFCDD370B427EE393AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E7356436AE5DD6441DC7C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A52204AD66C9FEB6E75002B1117B3ED696DE58EFE88E89714769995D676B7B4CBE823CB91A9FED034534781492E4B8EEAD14747542773C033FBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D65922A813C44217768E88BFCB5A131C91081B98376BF5D4FA75967E4DEE0E889C0E7CAB4BD571E2DBE4B8341EE9D5BE9A0A6BD4EAB246472CB7476169A593DFD19F44B81964BBA61C1A8CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVTZJppT4ZVHRTEYCBsG0UyU= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F2588458FD43DFC9DFB8B5A91F93A76BF6F7B0A61132AFF6A5CCA18427372178AB4246D3645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 14/41] perf: adjust mandelbrot 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. --------------ZIj6Q9J8UuqtsinPpVirVvMH Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 output is redirected to /dev/null. The check is skipped since it is > very inconvenient to check the binary output, especially since it may be > configured by the parameter. > --- > perf/LuaJIT-benches/mandelbrot.lua | 70 ++++++++++++++++++++++-------- > 1 file changed, 51 insertions(+), 19 deletions(-) > > diff --git a/perf/LuaJIT-benches/mandelbrot.lua b/perf/LuaJIT-benches/mandelbrot.lua > index 0ef595a2..999ff200 100644 > --- a/perf/LuaJIT-benches/mandelbrot.lua > +++ b/perf/LuaJIT-benches/mandelbrot.lua > @@ -1,23 +1,55 @@ > +-- The benchmark to check the performance of multiple inner loops > +-- with arithmetic operations. Calculates the Mandelbrot Set on a > +-- bitmap and dumps output in the portable bitmap format. > +-- For the details see: > +--https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/mandelbrot.html > > -local write, char, unpack = io.write, string.char, unpack > -local N = tonumber(arg and arg[1]) or 100 > -local M, ba, bb, buf = 2/N, 2^(N%8+1)-1, 2^(8-N%8), {} > -write("P4\n", N, " ", N, "\n") > -for y=0,N-1 do > - local Ci, b, p = y*M-1, 1, 0 > - for x=0,N-1 do > - local Cr = x*M-1.5 > - local Zr, Zi, Zrq, Ziq = Cr, Ci, Cr*Cr, Ci*Ci > - b = b + b > - for i=1,49 do > - Zi = Zr*Zi*2 + Ci > - Zr = Zrq-Ziq + Cr > - Ziq = Zi*Zi > - Zrq = Zr*Zr > - if Zrq+Ziq > 4.0 then b = b + 1; break; end > +local bench = require("bench").new(arg) > + > +local N = tonumber(arg and arg[1]) or 5000 > + > +local function payload() > + -- These functions must not be an upvalue but the stack slot. > + local N = N > + local write, char, unpack = io.write, string.char, unpack > + local M, ba, bb, buf = 2 / N, 2 ^ (N % 8 + 1) - 1, 2 ^ (8 - N % 8), {} > + write("P4\n", N, " ", N, "\n") > + for y = 0, N - 1 do > + local Ci, b, p = y * M - 1, 1, 0 > + for x = 0, N - 1 do > + local Cr = x * M - 1.5 > + local Zr, Zi, Zrq, Ziq = Cr, Ci, Cr * Cr, Ci * Ci > + b = b + b > + for i = 1, 49 do > + Zi = Zr * Zi * 2 + Ci > + Zr = Zrq - Ziq + Cr > + Ziq = Zi * Zi > + Zrq = Zr * Zr > + if Zrq + Ziq > 4.0 then b = b + 1; break; end > + end > + if b >= 256 then p = p + 1; buf[p] = 511 - b; b = 1; end > end > - if b >= 256 then p = p + 1; buf[p] = 511 - b; b = 1; end > + if b ~= 1 then p = p + 1; buf[p] = (ba - b) * bb; end > + write(char(unpack(buf, 1, p))) > end > - if b ~= 1 then p = p + 1; buf[p] = (ba-b)*bb; end > - write(char(unpack(buf, 1, p))) > end > + > +local stdout = io.output() > + > +bench:add({ > + name = "mandelbrot", > + items = N, > + -- XXX: This is inconvenient to have the binary file in the > + -- repository for the comparison. If the check is needed run, > + -- the payload manually. > + skip_check = true, > + setup = function() > + io.output("/dev/null") > + end, > + teardown = function() > + io.output(stdout) > + end, > + payload = payload, > +}) > + > +bench:run_and_report() --------------ZIj6Q9J8UuqtsinPpVirVvMH Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

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 output is redirected to /dev/null. The check is skipped since it is
very inconvenient to check the binary output, especially since it may be
configured by the parameter.
---
 perf/LuaJIT-benches/mandelbrot.lua | 70 ++++++++++++++++++++++--------
 1 file changed, 51 insertions(+), 19 deletions(-)

diff --git a/perf/LuaJIT-benches/mandelbrot.lua b/perf/LuaJIT-benches/mandelbrot.lua
index 0ef595a2..999ff200 100644
--- a/perf/LuaJIT-benches/mandelbrot.lua
+++ b/perf/LuaJIT-benches/mandelbrot.lua
@@ -1,23 +1,55 @@
+-- The benchmark to check the performance of multiple inner loops
+-- with arithmetic operations. Calculates the Mandelbrot Set on a
+-- bitmap and dumps output in the portable bitmap format.
+-- For the details see:
+-- https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/mandelbrot.html
 
-local write, char, unpack = io.write, string.char, unpack
-local N = tonumber(arg and arg[1]) or 100
-local M, ba, bb, buf = 2/N, 2^(N%8+1)-1, 2^(8-N%8), {}
-write("P4\n", N, " ", N, "\n")
-for y=0,N-1 do
-  local Ci, b, p = y*M-1, 1, 0
-  for x=0,N-1 do
-    local Cr = x*M-1.5
-    local Zr, Zi, Zrq, Ziq = Cr, Ci, Cr*Cr, Ci*Ci
-    b = b + b
-    for i=1,49 do
-      Zi = Zr*Zi*2 + Ci
-      Zr = Zrq-Ziq + Cr
-      Ziq = Zi*Zi
-      Zrq = Zr*Zr
-      if Zrq+Ziq > 4.0 then b = b + 1; break; end
+local bench = require("bench").new(arg)
+
+local N = tonumber(arg and arg[1]) or 5000
+
+local function payload()
+  -- These functions must not be an upvalue but the stack slot.
+  local N = N
+  local write, char, unpack = io.write, string.char, unpack
+  local M, ba, bb, buf = 2 / N, 2 ^ (N % 8 + 1) - 1, 2 ^ (8 - N % 8), {}
+  write("P4\n", N, " ", N, "\n")
+  for y = 0, N - 1 do
+    local Ci, b, p = y * M - 1, 1, 0
+    for x = 0, N - 1 do
+      local Cr = x * M - 1.5
+      local Zr, Zi, Zrq, Ziq = Cr, Ci, Cr * Cr, Ci * Ci
+      b = b + b
+      for i = 1, 49 do
+        Zi = Zr * Zi * 2 + Ci
+        Zr = Zrq - Ziq + Cr
+        Ziq = Zi * Zi
+        Zrq = Zr * Zr
+        if Zrq + Ziq > 4.0 then b = b + 1; break; end
+      end
+      if b >= 256 then p = p + 1; buf[p] = 511 - b; b = 1; end
     end
-    if b >= 256 then p = p + 1; buf[p] = 511 - b; b = 1; end
+    if b ~= 1 then p = p + 1; buf[p] = (ba - b) * bb; end
+    write(char(unpack(buf, 1, p)))
   end
-  if b ~= 1 then p = p + 1; buf[p] = (ba-b)*bb; end
-  write(char(unpack(buf, 1, p)))
 end
+
+local stdout = io.output()
+
+bench:add({
+  name = "mandelbrot",
+  items = N,
+  -- XXX: This is inconvenient to have the binary file in the
+  -- repository for the comparison. If the check is needed run,
+  -- the payload manually.
+  skip_check = true,
+  setup = function()
+    io.output("/dev/null")
+  end,
+  teardown = function()
+    io.output(stdout)
+  end,
+  payload = payload,
+})
+
+bench:run_and_report()
--------------ZIj6Q9J8UuqtsinPpVirVvMH--