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 ECEE516D4554; Fri, 2 Jan 2026 14:04:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ECEE516D4554 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1767351880; bh=HwEyuCLeNo/Uu9saBlmA9XQdcziZH6f7VmVEk1FtPhU=; 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=nAZFsfgVqECBzduLujszaRmIfj0YBhpgnbpgGEXlGTL0MZKC/FvQjn5ifZydnUdaF rwKStZIgfZp4LhzpRqxqzYgmOndyB4hedtyCX+lMj05rG+/hxwjcQmXe8SkitdiYDB s+YyC0Sf2tAgfVeFioivzWDoQO7vwDdOX3/doKF4= Received: from send240.i.mail.ru (send240.i.mail.ru [95.163.59.79]) (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 674EC16D4554 for ; Fri, 2 Jan 2026 14:04:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 674EC16D4554 Received: by exim-smtp-7b4fb89df9-j77gv with esmtpa (envelope-from ) id 1vbcxR-00000000L5V-1q75; Fri, 02 Jan 2026 14:04:37 +0300 Content-Type: multipart/alternative; boundary="------------SbcWt2e8ewLNI8eSKIZptSwj" Message-ID: <8d28719b-9f2c-4385-868a-f7e95bc21b5b@tarantool.org> Date: Fri, 2 Jan 2026 14:04:36 +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: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD915529E8FC4AA0671BD67E88CAEA01909A7D0956CEC736A9C1867C24CE74E72BB5FE18E9CBFBE7C074B324AFE7C96C1E53643B154362065B266284AF2D5829780E7A1F7137B3B460A51CE0648C9E8651D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AA1605287C7F04D6EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637FE9EFE935CD7C6AE8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B23891073562621DBE2E070BE324C7D3C4AC9B4E8A8D8C7A1CF6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249D082881546D93491CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0A29E2F051442AF778941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C046858BEBD2CECBDC7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B14AAC223A686B1DECB3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B53A69B3AC30C7B9475ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5CEB3071B5BAFD79E5002B1117B3ED696A3B3E41148B19FC6FB820E9FE7BD014C823CB91A9FED034534781492E4B8EEAD220496FFA5CD4785BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659DFEC1B82F85659D6E8258F1BAC88DFAD5383F280F873248A571034220E1BE5C6D5D13347174CBF66B8341EE9D5BE9A0A7CC88394D058F6BE09374FF75324713129889673E78B51A78CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVTZJppT4ZVHRNXdiQpnfriA= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F2588458F2A50419546C545BAAE6F637C7150CBC8926C3FFD2C999F297C07B33C6D957A5645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 21/41] perf: adjust partialsums 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. --------------SbcWt2e8ewLNI8eSKIZptSwj 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. > --- > perf/LuaJIT-benches/partialsums.lua | 73 ++++++++++++++++++----------- > 1 file changed, 46 insertions(+), 27 deletions(-) > > diff --git a/perf/LuaJIT-benches/partialsums.lua b/perf/LuaJIT-benches/partialsums.lua > index 46bb9da3..2e5967d2 100644 > --- a/perf/LuaJIT-benches/partialsums.lua > +++ b/perf/LuaJIT-benches/partialsums.lua > @@ -1,29 +1,48 @@ > +-- The benchmark to check the performance of FP arithmetic and > +-- math functions. Calculates the partial sums of several series > +-- in the single loop. > > -local n = tonumber(arg[1]) > -local function pr(fmt, x) io.write(string.format(fmt, x)) end > +local bench = require("bench").new(arg) > > -local a1, a2, a3, a4, a5, a6, a7, a8, a9, alt = 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 > -local sqrt, sin, cos = math.sqrt, math.sin, math.cos > -for k=1,n do > - local k2, sk, ck = k*k, sin(k), cos(k) > - local k3 = k2*k > - a1 = a1 + (2/3)^k > - a2 = a2 + 1/sqrt(k) > - a3 = a3 + 1/(k2+k) > - a4 = a4 + 1/(k3*sk*sk) > - a5 = a5 + 1/(k3*ck*ck) > - a6 = a6 + 1/k > - a7 = a7 + 1/k2 > - a8 = a8 + alt/k > - a9 = a9 + alt/(k+k-1) > - alt = -alt > -end > -pr("%.9f\t(2/3)^k\n", a1) > -pr("%.9f\tk^-0.5\n", a2) > -pr("%.9f\t1/k(k+1)\n", a3) > -pr("%.9f\tFlint Hills\n", a4) > -pr("%.9f\tCookson Hills\n", a5) > -pr("%.9f\tHarmonic\n", a6) > -pr("%.9f\tRiemann Zeta\n", a7) > -pr("%.9f\tAlternating Harmonic\n", a8) > -pr("%.9f\tGregory\n", a9) > +local DEFAULT_N = 1e7 > +local n = tonumber(arg[1]) or DEFAULT_N > + > +bench:add({ > + name = "partialsums", > + payload = function() > + local a1, a2, a3, a4, a5, a6, a7, a8, a9, alt = 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 > + local sqrt, sin, cos = math.sqrt, math.sin, math.cos > + for k = 1, n do > + local k2, sk, ck = k * k, sin(k), cos(k) > + local k3 = k2 * k > + a1 = a1 + (2 / 3) ^ k > + a2 = a2 + 1 / sqrt(k) > + a3 = a3 + 1 / (k2 + k) > + a4 = a4 + 1 / (k3 * sk * sk) > + a5 = a5 + 1 / (k3 * ck * ck) > + a6 = a6 + 1 / k > + a7 = a7 + 1 / k2 > + a8 = a8 + alt / k > + a9 = a9 + alt / (k + k - 1) > + alt = -alt > + end > + return {a1, a2, a3, a4, a5, a6, a7, a8, a9} > + end, > + checker = function(a) > + if n == DEFAULT_N then > + assert(a[1] == 2.99999999999999866773) > + assert(a[2] == 6323.09512394020111969439) > + assert(a[3] == 0.99999989999981531152) > + assert(a[4] == 30.31454593111029183206) > + assert(a[5] == 42.99523427973661426904) > + assert(a[6] == 16.69531136585727182364) > + assert(a[7] == 1.64493396684725956547) > + assert(a[8] == 0.69314713056010635039) > + assert(a[9] == 0.78539813839744787582) > + end > + return true > + end, > + items = n, > +}) > + > +bench:run_and_report() --------------SbcWt2e8ewLNI8eSKIZptSwj 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.
---
 perf/LuaJIT-benches/partialsums.lua | 73 ++++++++++++++++++-----------
 1 file changed, 46 insertions(+), 27 deletions(-)

diff --git a/perf/LuaJIT-benches/partialsums.lua b/perf/LuaJIT-benches/partialsums.lua
index 46bb9da3..2e5967d2 100644
--- a/perf/LuaJIT-benches/partialsums.lua
+++ b/perf/LuaJIT-benches/partialsums.lua
@@ -1,29 +1,48 @@
+-- The benchmark to check the performance of FP arithmetic and
+-- math functions. Calculates the partial sums of several series
+-- in the single loop.
 
-local n = tonumber(arg[1])
-local function pr(fmt, x) io.write(string.format(fmt, x)) end
+local bench = require("bench").new(arg)
 
-local a1, a2, a3, a4, a5, a6, a7, a8, a9, alt = 1, 0, 0, 0, 0, 0, 0, 0, 0, 1
-local sqrt, sin, cos = math.sqrt, math.sin, math.cos
-for k=1,n do
-  local k2, sk, ck = k*k, sin(k), cos(k)
-  local k3 = k2*k
-  a1 = a1 + (2/3)^k
-  a2 = a2 + 1/sqrt(k)
-  a3 = a3 + 1/(k2+k)
-  a4 = a4 + 1/(k3*sk*sk)
-  a5 = a5 + 1/(k3*ck*ck)
-  a6 = a6 + 1/k
-  a7 = a7 + 1/k2
-  a8 = a8 + alt/k
-  a9 = a9 + alt/(k+k-1)
-  alt = -alt
-end
-pr("%.9f\t(2/3)^k\n", a1)
-pr("%.9f\tk^-0.5\n", a2)
-pr("%.9f\t1/k(k+1)\n", a3)
-pr("%.9f\tFlint Hills\n", a4)
-pr("%.9f\tCookson Hills\n", a5)
-pr("%.9f\tHarmonic\n", a6)
-pr("%.9f\tRiemann Zeta\n", a7)
-pr("%.9f\tAlternating Harmonic\n", a8)
-pr("%.9f\tGregory\n", a9)
+local DEFAULT_N = 1e7
+local n = tonumber(arg[1]) or DEFAULT_N
+
+bench:add({
+  name = "partialsums",
+  payload = function()
+    local a1, a2, a3, a4, a5, a6, a7, a8, a9, alt = 1, 0, 0, 0, 0, 0, 0, 0, 0, 1
+    local sqrt, sin, cos = math.sqrt, math.sin, math.cos
+    for k = 1, n do
+      local k2, sk, ck = k * k, sin(k), cos(k)
+      local k3 = k2 * k
+      a1 = a1 + (2 / 3) ^ k
+      a2 = a2 + 1 / sqrt(k)
+      a3 = a3 + 1 / (k2 + k)
+      a4 = a4 + 1 / (k3 * sk * sk)
+      a5 = a5 + 1 / (k3 * ck * ck)
+      a6 = a6 + 1 / k
+      a7 = a7 + 1 / k2
+      a8 = a8 + alt / k
+      a9 = a9 + alt / (k + k - 1)
+      alt = -alt
+    end
+    return {a1, a2, a3, a4, a5, a6, a7, a8, a9}
+  end,
+  checker = function(a)
+    if n == DEFAULT_N then
+      assert(a[1] == 2.99999999999999866773)
+      assert(a[2] == 6323.09512394020111969439)
+      assert(a[3] == 0.99999989999981531152)
+      assert(a[4] == 30.31454593111029183206)
+      assert(a[5] == 42.99523427973661426904)
+      assert(a[6] == 16.69531136585727182364)
+      assert(a[7] == 1.64493396684725956547)
+      assert(a[8] == 0.69314713056010635039)
+      assert(a[9] == 0.78539813839744787582)
+    end
+    return true
+  end,
+  items = n,
+})
+
+bench:run_and_report()
--------------SbcWt2e8ewLNI8eSKIZptSwj--