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 C779316AFFFE; Fri, 26 Dec 2025 12:25:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C779316AFFFE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1766741122; bh=BqJJnxzAogPVKR+QUT8HYBl/tS7uGqt6P6VZm5ydPqU=; 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=fDIZ0w3n5UdOuOggZfjZ3MwAcMKmHX+TjQpIW/3oNWUo6JL8jEJQEDH+aqHqCAMag jGAQCDA5sMa0cmD7NxXtjfN8Orq29JNEmgusu4GbAx8IP7dqeyriw58NrW6BdrfZnJ Y+GcwM+v/CncILLWPdl1/2WITpNWa8JOaVDcxX7E= Received: from send278.i.mail.ru (send278.i.mail.ru [95.163.59.117]) (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 5766716C6588 for ; Fri, 26 Dec 2025 12:18:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5766716C6588 Received: by exim-smtp-7b4fb89df9-lft7n with esmtpa (envelope-from ) id 1vZ3y2-000000008Cp-0ndR; Fri, 26 Dec 2025 12:18:38 +0300 To: Sergey Bronnikov Date: Fri, 26 Dec 2025 12:17:45 +0300 Message-ID: X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBD136B1DE29D0A141801E96C80D96E6DBF182A05F53808504025251CA98D3432F83DE06ABAFEAF67054D98280BAFF6A4A0B4FA2C6BBBE99EF9ACCB5262BB581CA2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7876E9C5582D2D91DEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566657B88B02DF8C8697AD4A3DE900644BA8EDCD39A7D089D1AF735547B0F12DA8A389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C05A64D9A1E9CA65708941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6AEEA5BB16A939343CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE79E9721B410A3B6ED731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A5976DB64A839A1B805002B1117B3ED69659F0C38D12C53B61BFF4097FFC9E796F823CB91A9FED034534781492E4B8EEAD6804EF05EF4ADF2AF36E2E0160E5C55395B8A2A0B6518DF68C46860778A80D548E8926FB43031F38 X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659310B47CB7892142CC25053ACA2C1EE4CC4BD7D9FC65ADB75FAE4C1CB100A5FD368F77F47BF20AA60B8341EE9D5BE9A0AF6CE7560BC21032D05D8439B09F6DFF0645479FAED58BB1F6536EB022892E5344C41F94D744909CECFA6C6B0C050A61A8CAF69B82BA93681CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVdtTL5f5BIXbu5+ycRus1mw= X-Mailru-Sender: 689FA8AB762F7393DDD5FD59B456EAD2E7ABAC0D70D942D68700636FE984EBB8123FA2B17E64E1E4E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: [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 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.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() -- 2.52.0