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 61A3E16D4540; Fri, 2 Jan 2026 13:57:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 61A3E16D4540 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1767351469; bh=T7GKWbaGFMVH9NQvfmOnBlSNi1GIvco54yHOenkIBg8=; 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=e9FlFGGL82iv4QbVrsWgIj7vLO1xhfzJvhjFU5O9Vf+eCSFRMKfJSCMZG0O3zZVg7 yvh+QmZllWw0vnb7QNcrT6Ecl/zsvWZBi/cOPA6mOl4g+FGMkYB6kb/Vsw3IYzgvRk MJflJv6eVumq8hZgd0YAW69wJWvPaCYiPQnwpeUY= Received: from send129.i.mail.ru (send129.i.mail.ru [89.221.237.224]) (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 663FB16D2275 for ; Fri, 2 Jan 2026 13:57:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 663FB16D2275 Received: by exim-smtp-7b4fb89df9-xh88n with esmtpa (envelope-from ) id 1vbcqp-00000000P3U-0Nw7; Fri, 02 Jan 2026 13:57:47 +0300 Content-Type: multipart/alternative; boundary="------------aDMkaitIqIgQNJfcuB6NEVF3" Message-ID: <5ab9da5f-a6a9-4239-bf26-8e307d00fc13@tarantool.org> Date: Fri, 2 Jan 2026 13:57:46 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <4c808789457cabe2f141019c8a2c07d4fa4a60f5.1766738771.git.skaplun@tarantool.org> In-Reply-To: <4c808789457cabe2f141019c8a2c07d4fa4a60f5.1766738771.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBD136B1DE29D0A141801E96C80D96E6DBF182A05F5380850409F933C62AC79755E3DE06ABAFEAF6705FEC6CCF3A84B98BA8AD633589A7BAE8BAD39CAEC4D145104 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE711269A7C2F827F16EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F88016AB904663428638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B29530B2CD0104662C2E070BE324C7D3C433EB73F2BAA50666F6B57BC7E64490618DEB871D839B73339E8FC8737B5C22494854413538E1713FCC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0ECC8AC47CD0EDEFF8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C046858BEBD2CECBDC7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B14AAC223A686B1DECB3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B9149C560DC76099D75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5FFD21376B35C60D95002B1117B3ED696FC70F7E2E8ABA07CC66B2B37046EC955823CB91A9FED034534781492E4B8EEAD220496FFA5CD4785BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659ECADCA7DA7906ED8475A331879042E242019A18CCF674ADB0CBC93137F9F96711388C394B1124E43B8341EE9D5BE9A0A97EC0E55E8D314CB6AA8AE737A66B8C1BE097A66F58145028CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVTZJppT4ZVHRnf8u0eey/+I= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F25884583E79B2E754DDDEB8D4570605F44DF537E56E3F45FF115BAC897BCE4027D2098D645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 19/41] perf: adjust nsieve-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 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. --------------aDMkaitIqIgQNJfcuB6NEVF3 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/nsieve-bit.lua | 41 ++++++++++++++++++++++++++---- > 1 file changed, 36 insertions(+), 5 deletions(-) > > diff --git a/perf/LuaJIT-benches/nsieve-bit.lua b/perf/LuaJIT-benches/nsieve-bit.lua > index 820a3726..0f6e49c8 100644 > --- a/perf/LuaJIT-benches/nsieve-bit.lua > +++ b/perf/LuaJIT-benches/nsieve-bit.lua > @@ -1,3 +1,10 @@ > +-- Benchmark to check the performance of bitwise arithmetics and > +-- access to the array structure. This benchmark finds all prime > +-- numbers in a given segment. This is the bit variation. > +-- For the details see: > +--https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes > + > +local bench = require("bench").new(arg) > > local bit = require("bit") > local band, bxor, rshift, rol = bit.band, bit.bxor, bit.rshift, bit.rol > @@ -17,11 +24,35 @@ local function nsieve(p, m) > return count > end > > -local N = tonumber(arg and arg[1]) or 1 > +local DEFAULT_N = 12 > +local N = tonumber(arg and arg[1]) or DEFAULT_N > if N < 2 then N = 2 end > local primes = {} > > -for i=0,2 do > - local m = (2^(N-i))*10000 > - io.write(string.format("Primes up to %8d %8d\n", m, nsieve(primes, m))) > -end > +local benchmark > +benchmark = { > + name = "nsieve_bit", > + payload = function() > + local res = {} > + local items = 0 > + for i = 0, 2 do > + local m = (2 ^ (N - i)) * 10000 > + items = items + m > + res[i] = nsieve(primes, m) > + end > + benchmark.items = items > + > + return res > + end, > + checker = function(res) > + if N == DEFAULT_N then > + assert(res[0] == 2488465) > + assert(res[1] == 1299069) > + assert(res[2] == 679461) > + end > + return true > + end, > +} > + > +bench:add(benchmark) > +bench:run_and_report() --------------aDMkaitIqIgQNJfcuB6NEVF3 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/nsieve-bit.lua | 41 ++++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/perf/LuaJIT-benches/nsieve-bit.lua b/perf/LuaJIT-benches/nsieve-bit.lua
index 820a3726..0f6e49c8 100644
--- a/perf/LuaJIT-benches/nsieve-bit.lua
+++ b/perf/LuaJIT-benches/nsieve-bit.lua
@@ -1,3 +1,10 @@
+-- Benchmark to check the performance of bitwise arithmetics and
+-- access to the array structure. This benchmark finds all prime
+-- numbers in a given segment. This is the bit variation.
+-- For the details see:
+-- https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
+
+local bench = require("bench").new(arg)
 
 local bit = require("bit")
 local band, bxor, rshift, rol = bit.band, bit.bxor, bit.rshift, bit.rol
@@ -17,11 +24,35 @@ local function nsieve(p, m)
   return count
 end
 
-local N = tonumber(arg and arg[1]) or 1
+local DEFAULT_N = 12
+local N = tonumber(arg and arg[1]) or DEFAULT_N
 if N < 2 then N = 2 end
 local primes = {}
 
-for i=0,2 do
-  local m = (2^(N-i))*10000
-  io.write(string.format("Primes up to %8d %8d\n", m, nsieve(primes, m)))
-end
+local benchmark
+benchmark = {
+  name = "nsieve_bit",
+  payload = function()
+    local res = {}
+    local items = 0
+    for i = 0, 2 do
+      local m = (2 ^ (N - i)) * 10000
+      items = items + m
+      res[i] = nsieve(primes, m)
+    end
+    benchmark.items = items
+
+    return res
+  end,
+  checker = function(res)
+    if N == DEFAULT_N then
+      assert(res[0] == 2488465)
+      assert(res[1] == 1299069)
+      assert(res[2] == 679461)
+    end
+    return true
+  end,
+}
+
+bench:add(benchmark)
+bench:run_and_report()
--------------aDMkaitIqIgQNJfcuB6NEVF3--