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 5B815167920E; Fri, 26 Dec 2025 11:20:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5B815167920E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1766737253; bh=sGpe42DY0dnVTPYrudnTCwqoeFZ7a5qgU888m1WvRAs=; 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=TBjdJ0d+LsiHopRrRN+VNFz7YasM7LyVxS3JP2XFFERaq/Wkrab4SI88Vv321UDDn hIgeLD3RWPAZ9fW/gh631+dl9IFsTruwrbH24zr/BGjjJx8l5G83cLswPZ8wZOPoWd BCv6x9mJgPsgvgkoiVV4zC9WQmRqfW41lnZUB/uI= Received: from send194.i.mail.ru (send194.i.mail.ru [95.163.59.33]) (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 3E6B41679201 for ; Fri, 26 Dec 2025 11:20:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3E6B41679201 Received: by exim-smtp-7b4fb89df9-6bbps with esmtpa (envelope-from ) id 1vZ343-00000000bI4-11DQ; Fri, 26 Dec 2025 11:20:47 +0300 Date: Fri, 26 Dec 2025 11:20:45 +0300 To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBDD803ECE58504FBFD117E6A90C4FE9736182A05F5380850408C354DFE9F49CF303DE06ABAFEAF6705CCC93C3CE6AAE542C3CE4153D521EAFE386F63046B3269FA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74323F140F3EE5B6AC2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6759CC434672EE6371C2A783ECEC0211ADC4224003CC836476D5A39DEEDB180909611E41BBFE2FEB2B7B4699E5C84C05A133B427ABC482C2BFAC828A81E77FFD8356726F760977580B9FA2833FD35BB23D9E625A9149C048EE33AC447995A7AD18C26CFBAC0749D213D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8B2EE5AD8F952D28FBA471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C837C4FEFBD186071C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A55F007709B462AF545002B1117B3ED696DDA54F634312DECFB74D9144D44E4FCF823CB91A9FED034534781492E4B8EEADB73CFAAED92B6E13BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659056E992608EB1570D0ADE83833299D882161F8C219A0AD78DEA5065DC2F98D4E19B35EA252D68AAEB8341EE9D5BE9A0A595DEDBB9EB61B0584F4AB5B1169D35A2745FF26C648E4C78CD93680B12512CF4C41F94D744909CECFA6C6B0C050A61A8CAF69B82BA93681CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVdtTL5f5BIXbnvDrMW17Qq4= X-DA7885C5: 87BA8240B19177A8F255D290C0D534F956D041F56FB74E229518BCF6ED9C22F7FE3796CC071E94915B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393DDD5FD59B456EAD2A6C85A1897FA8DB6EC3FBAA55FBF83C54A4EBD9E7371718FE49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 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 Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the review. Fixed you comments and added the description for the benchmark. On 23.12.25, Sergey Bronnikov wrote: > 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 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 | 64 +++++++++++++++++++++--------- > > 1 file changed, 45 insertions(+), 19 deletions(-) > > > > diff --git a/perf/LuaJIT-benches/mandelbrot.lua b/perf/LuaJIT-benches/mandelbrot.lua > > index 0ef595a2..51e0dd4f 100644 > > --- a/perf/LuaJIT-benches/mandelbrot.lua > > +++ b/perf/LuaJIT-benches/mandelbrot.lua > > @@ -1,23 +1,49 @@ Added the comment with the short benchmark description, as we discussed offline: =================================================================== diff --git a/perf/LuaJIT-benches/mandelbrot.lua b/perf/LuaJIT-benches/mandelbrot.lua index 8b7310b8..999ff200 100644 --- a/perf/LuaJIT-benches/mandelbrot.lua +++ b/perf/LuaJIT-benches/mandelbrot.lua @@ -1,3 +1,9 @@ +-- 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 bench = require("bench").new(arg) local N = tonumber(arg and arg[1]) or 5000 =================================================================== > > +local bench = require("bench").new(arg) > > > > -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 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), {} > please add more whitespaces. Here and below. Rewritten as you suggested: =================================================================== diff --git a/perf/LuaJIT-benches/mandelbrot.lua b/perf/LuaJIT-benches/mandelbrot.lua index 51e0dd4f..8b7310b8 100644 --- a/perf/LuaJIT-benches/mandelbrot.lua +++ b/perf/LuaJIT-benches/mandelbrot.lua @@ -6,24 +6,24 @@ 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), {} + 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 + 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 + 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 ~= 1 then p = p + 1; buf[p] = (ba-b)*bb; end + if b ~= 1 then p = p + 1; buf[p] = (ba - b) * bb; end write(char(unpack(buf, 1, p))) end end =================================================================== > > + write("P4\n", N, " ", N, "\n") -- Best regards, Sergey Kaplun