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 3B5A715D659C; Fri, 24 Oct 2025 13:57:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3B5A715D659C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1761303435; bh=Koj3Otzi9dI1qTIFZifLvS0g1xk9vtTLhITKOeaYwMU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=VFaMQkOBIJ+7sfiSRcrdrx8OMqp5KnW9B5NH1ilysJYGlG0LOS1oqiM/VGEl9wTPF 77NoYynyqQM3GdJItdlAFA9kGXKHjR1UQSXOFvRK9FkOYWoAn0Gk0Wk4SJbJY4VxcT fwnNnOThb4wpdOZ8/Xvfr+BxxKrkfEciUDrR/ssI= Received: from send35.i.mail.ru (send35.i.mail.ru [89.221.237.130]) (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 388E715F7CC2 for ; Fri, 24 Oct 2025 13:51:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 388E715F7CC2 Received: by exim-smtp-855f5997bb-88mr2 with esmtpa (envelope-from ) id 1vCFNt-000000006vv-0SKC; Fri, 24 Oct 2025 13:51:01 +0300 To: Sergey Bronnikov Date: Fri, 24 Oct 2025 13:50:17 +0300 Message-ID: <8bfd29047e9f8af98dfc43ac86cfc390ebd03484.1761301736.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD9DAB542EDD08389FE3A1DC7F2165CDF75DA90D95266D572EE182A05F538085040909DBCB3B45DF5753DE06ABAFEAF6705F3DE7D4DB872539352E7C6720268728EBD3E183E79334B09 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE707314F92EEE30EB3EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566D857902A848E84F83850FE93CB7E81BA282EBDC4CF679BDE4FCE7C48C3C77BC0389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0CB629EEF1311BF91D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8B9FC99A4BA45EE8B4A471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CB601CEFCD1BC935243847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A597A421312368CB5E5002B1117B3ED6969B41919F30AA66A830C8F815570A3530823CB91A9FED034534781492E4B8EEAD05E80F4396618BB2C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF332D4B002A88F14BE2C474F31B7087EAE64643A0E93399D9FF06A9891C12652360849098BFF6585A6EB503EC62A3E87FB35628A759B6F029E2422C6CC32E61FE8C4445792AFDC6935F4332CA8FE04980913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVRN2q9QiacRupum/49WAAFc= X-DA7885C5: F3242597537CC689F255D290C0D534F9C81D38000A6B67B6C9D7B1F0EEAAF21E655C111688F94ED55B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393DDD5FD59B456EAD278BB2A9BB8D7B28811988E4495A63B6E22F53493B388A7A6E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: [Tarantool-patches] [PATCH v1 luajit 13/41] perf: adjust mandelbrot-bit 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 Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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-bit.lua | 86 +++++++++++++++++--------- 1 file changed, 57 insertions(+), 29 deletions(-) diff --git a/perf/LuaJIT-benches/mandelbrot-bit.lua b/perf/LuaJIT-benches/mandelbrot-bit.lua index 91d96975..a6b5e1f8 100644 --- a/perf/LuaJIT-benches/mandelbrot-bit.lua +++ b/perf/LuaJIT-benches/mandelbrot-bit.lua @@ -1,33 +1,61 @@ - local bit = require("bit") -local bor, band = bit.bor, bit.band -local shl, shr, rol = bit.lshift, bit.rshift, bit.rol -local write, char, unpack = io.write, string.char, unpack -local N = tonumber(arg and arg[1]) or 100 -local M, buf = 2/N, {} -write("P4\n", N, " ", N, "\n") -for y=0,N-1 do - local Ci, b, p = y*M-1, -16777216, 0 - local Ciq = Ci*Ci - for x=0,N-1,2 do - local Cr, Cr2 = x*M-1.5, (x+1)*M-1.5 - local Zr, Zi, Zrq, Ziq = Cr, Ci, Cr*Cr, Ciq - local Zr2, Zi2, Zrq2, Ziq2 = Cr2, Ci, Cr2*Cr2, Ciq - b = rol(b, 2) - for i=1,49 do - Zi = Zr*Zi*2 + Ci; Zi2 = Zr2*Zi2*2 + Ci - Zr = Zrq-Ziq + Cr; Zr2 = Zrq2-Ziq2 + Cr2 - Ziq = Zi*Zi; Ziq2 = Zi2*Zi2 - Zrq = Zr*Zr; Zrq2 = Zr2*Zr2 - if band(b, 2) ~= 0 and Zrq+Ziq > 4.0 then b = band(b, -3) end - if band(b, 1) ~= 0 and Zrq2+Ziq2 > 4.0 then b = band(b, -2) end - if band(b, 3) == 0 then 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 bor, band = bit.bor, bit.band + local shl, shr, rol = bit.lshift, bit.rshift, bit.rol + local write, char, unpack = io.write, string.char, unpack + + local M, buf = 2/N, {} + write("P4\n", N, " ", N, "\n") + for y=0,N-1 do + local Ci, b, p = y*M-1, -16777216, 0 + local Ciq = Ci*Ci + for x=0,N-1,2 do + local Cr, Cr2 = x*M-1.5, (x+1)*M-1.5 + local Zr, Zi, Zrq, Ziq = Cr, Ci, Cr*Cr, Ciq + local Zr2, Zi2, Zrq2, Ziq2 = Cr2, Ci, Cr2*Cr2, Ciq + b = rol(b, 2) + for i=1,49 do + Zi = Zr*Zi*2 + Ci; Zi2 = Zr2*Zi2*2 + Ci + Zr = Zrq-Ziq + Cr; Zr2 = Zrq2-Ziq2 + Cr2 + Ziq = Zi*Zi; Ziq2 = Zi2*Zi2 + Zrq = Zr*Zr; Zrq2 = Zr2*Zr2 + if band(b, 2) ~= 0 and Zrq+Ziq > 4.0 then b = band(b, -3) end + if band(b, 1) ~= 0 and Zrq2+Ziq2 > 4.0 then b = band(b, -2) end + if band(b, 3) == 0 then break end + end + if b >= 0 then p = p + 1; buf[p] = b; b = -16777216; end end - if b >= 0 then p = p + 1; buf[p] = b; b = -16777216; end - end - if b ~= -16777216 then - if band(N, 1) ~= 0 then b = shr(b, 1) end - p = p + 1; buf[p] = shl(b, 8-band(N, 7)) + if b ~= -16777216 then + if band(N, 1) ~= 0 then b = shr(b, 1) end + p = p + 1; buf[p] = shl(b, 8-band(N, 7)) + end + write(char(unpack(buf, 1, p))) end - write(char(unpack(buf, 1, p))) end + +local stdout = io.output() + +bench:add({ + name = "mandelbrot_bit", + 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() -- 2.51.0