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 5D31116D4545; Fri, 2 Jan 2026 14:01:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5D31116D4545 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1767351689; bh=bAGrWT3vCX/vsryev9eAMdcuNBNVl6chA57xnI51yaY=; 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=UcgK6/xtfWkVXmj6ftVM+OxE5QzRLNTuBWBkEJVD/gsCURf9kBnKBU8XZ/E5SqaBj 4xoIRyEFT8OQITg5RDcEDNaMiR7xKDhjXPoMeyI6/ckTWWhzuPP5yT3/uxrByvSliD IpaieychRrygWUKXSWsI6rU65FY1SLPyNnO/OCPI= Received: from send266.i.mail.ru (send266.i.mail.ru [95.163.59.105]) (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 C69D716D4545 for ; Fri, 2 Jan 2026 14:01:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C69D716D4545 Received: by exim-smtp-7b4fb89df9-pjsp6 with esmtpa (envelope-from ) id 1vbcuN-00000000DUY-3LnT; Fri, 02 Jan 2026 14:01:28 +0300 Content-Type: multipart/alternative; boundary="------------3kXRNJprkSab3Y6rIIRPY9Ol" Message-ID: Date: Fri, 2 Jan 2026 14:01:27 +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: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD979975AF0D777FEBD651A111AECFA267DF4E9497E9DD4D3AA182A05F538085040FABA720171E3B0D43DE06ABAFEAF6705D4C9EF1CCAB4472D8AD633589A7BAE8BF206EA752E207D6A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BA0D57D3459E5640EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637FE9EFE935CD7C6AE8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2FAD4CE7971FD94652E070BE324C7D3C431834E6556AE01E7F6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249957A4DEDD2346B42CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0A29E2F051442AF778941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C046858BEBD2CECBDC7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B14AAC223A686B1DECB3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B9149C560DC76099D75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5BDE0A5DAD1C89E115002B1117B3ED69628D73C0CACECA55A484B8D70797403F6823CB91A9FED034534781492E4B8EEADAE4FDBF11360AC9BBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE191716CD42B3DD1D34CAB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659436D8A6ACE77251F09114DA0E9423ADC5F32F3F387EAB6BBE770C9D66AC89F32BBD575E3AC96770EB8341EE9D5BE9A0A677E4F7CFD8BCA7731A758C1FC77283F56E6B6E381CA27AA8CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVTZJppT4ZVHRLq/YAo22gc8= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F2588458A577D91B9833DA1C965EDF11CFD47EC7CB5ECDE535C60DFA7C9851A8B9F6C68F645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 20/41] perf: adjust nsieve 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. --------------3kXRNJprkSab3Y6rIIRPY9Ol 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.lua | 42 ++++++++++++++++++++++++++++++---- > 1 file changed, 37 insertions(+), 5 deletions(-) > > diff --git a/perf/LuaJIT-benches/nsieve.lua b/perf/LuaJIT-benches/nsieve.lua > index 6de0524f..dd59c71c 100644 > --- a/perf/LuaJIT-benches/nsieve.lua > +++ b/perf/LuaJIT-benches/nsieve.lua > @@ -1,3 +1,11 @@ > +-- Benchmark to check the performance of access to the array > +-- structure in the tiny inner loops. This benchmark finds all the > +-- prime numbers in a given segment. This is the most > +-- straightforward implementation. > +-- For the details see: > +--https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes > + > +local bench = require("bench").new(arg) > > local function nsieve(p, m) > for i=2,m do p[i] = true end > @@ -11,11 +19,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", > + 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() --------------3kXRNJprkSab3Y6rIIRPY9Ol 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.lua | 42 ++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/perf/LuaJIT-benches/nsieve.lua b/perf/LuaJIT-benches/nsieve.lua
index 6de0524f..dd59c71c 100644
--- a/perf/LuaJIT-benches/nsieve.lua
+++ b/perf/LuaJIT-benches/nsieve.lua
@@ -1,3 +1,11 @@
+-- Benchmark to check the performance of access to the array
+-- structure in the tiny inner loops. This benchmark finds all the
+-- prime numbers in a given segment. This is the most
+-- straightforward implementation.
+-- For the details see:
+-- https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
+
+local bench = require("bench").new(arg)
 
 local function nsieve(p, m)
   for i=2,m do p[i] = true end
@@ -11,11 +19,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",
+  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()
--------------3kXRNJprkSab3Y6rIIRPY9Ol--