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 1C8E915DEA9C; Mon, 17 Nov 2025 16:28:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1C8E915DEA9C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1763386123; bh=rhHoCvfGkR+Nn+jcuOskLUsVhqGvd/XlX+vUHflVxj8=; 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=v8590eWV7vT9ZA03QXshfGaqW7P4q1fO5LxrAwAUD7sR28IMOCEIaFlLIos5wU7D0 t1idGIQ3aSQeJf2+hRemOLtoOb9qk5wbO7DPPSqGnZdTMoumagGTZIkuRruMVfh7r5 cBNtipEWA6RIBa/HaURA2rIFk6W37zO6Ene76LRQ= Received: from send173.i.mail.ru (send173.i.mail.ru [95.163.59.12]) (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 7D93B15DEA86 for ; Mon, 17 Nov 2025 16:26:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7D93B15DEA86 Received: by exim-smtp-77df68b9cf-k4thg with esmtpa (envelope-from ) id 1vKzFB-00000000Aek-2pDD; Mon, 17 Nov 2025 16:26:10 +0300 Content-Type: multipart/alternative; boundary="------------oPBpwHaTgNpkprK1hMa063d6" Message-ID: <12bc2ee6-c501-4892-a650-047ba1427837@tarantool.org> Date: Mon, 17 Nov 2025 16:26:09 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <3f2714c31979df69479b64c21453442e7d0539db.1761301736.git.skaplun@tarantool.org> In-Reply-To: <3f2714c31979df69479b64c21453442e7d0539db.1761301736.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9110BAFCBE6BD1D16AB96D75D320B032589E627B9C0ACA6CC182A05F538085040E7E65CEE100994E43DE06ABAFEAF670520E39A74E37102C23C1CBB97E487F8EEA4B6E33E76DF1710 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7235646FAB97B4BEDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637FE9EFE935CD7C6AE8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B28CFE8422134C1EB52E070BE324C7D3C4D0A33561CBD5B40FF6B57BC7E64490618DEB871D839B73339E8FC8737B5C22498424CA1AAF98A6958941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6D082881546D93491CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C224958C1606C78F2434E76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B6A4E49BB0F3BA1413AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E73557739F23D657EF2BB5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A551CEA05A2584940D5002B1117B3ED6964F140CECAD9B44263E67C18142C611B7823CB91A9FED034534781492E4B8EEADA91A6E18C88C5E2F X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF8A5FB081F9144BD4BC2A8732A46988E522A730C87388DC25F97927B2CF4087F3A7825560E8A5912CDD12B02666E49356850DD58F99AEA51EE17169D636A22569BE4F9D93979CEF9A111DC66A97D0BFE2913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVfFX+FmbwDW1fEO2QVXLaCA= X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B598FE385565030E4E53DE06ABAFEAF670520E39A74E37102C2B7CBEF92542CD7C8795FA72BAB74744FC77752E0C033A69EA16A481184E8BB1C9B38E6EA4F046BE03A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 luajit 18/41] perf: adjust nsieve-bit-fp 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. --------------oPBpwHaTgNpkprK1hMa063d6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey, thanks for the patch! See my comments. Sergey On 10/24/25 13:50, 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-fp.lua | 35 +++++++++++++++++++++++---- > 1 file changed, 30 insertions(+), 5 deletions(-) > > diff --git a/perf/LuaJIT-benches/nsieve-bit-fp.lua b/perf/LuaJIT-benches/nsieve-bit-fp.lua > index 3971ec1f..d0ab23d2 100644 > --- a/perf/LuaJIT-benches/nsieve-bit-fp.lua > +++ b/perf/LuaJIT-benches/nsieve-bit-fp.lua > @@ -1,3 +1,4 @@ > +local bench = require("bench").new(arg) > > local floor, ceil = math.floor, math.ceil > > @@ -27,11 +28,35 @@ local function nsieve(p, m) > return count > end > > -local N = tonumber(arg and arg[1]) or 1 > +local DEFAULT_N = 12 Why 12 instead of 1? > +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_fp", > + payload = function() > + local res = {} > + local items = 0 > + for i=0,2 do add more whitespaces > + local m = (2^(N-i))*10000 add more whitespaces > + 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() --------------oPBpwHaTgNpkprK1hMa063d6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey,

thanks for the patch! See my comments.

Sergey

On 10/24/25 13:50, 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-fp.lua | 35 +++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/perf/LuaJIT-benches/nsieve-bit-fp.lua b/perf/LuaJIT-benches/nsieve-bit-fp.lua
index 3971ec1f..d0ab23d2 100644
--- a/perf/LuaJIT-benches/nsieve-bit-fp.lua
+++ b/perf/LuaJIT-benches/nsieve-bit-fp.lua
@@ -1,3 +1,4 @@
+local bench = require("bench").new(arg)
 
 local floor, ceil = math.floor, math.ceil
 
@@ -27,11 +28,35 @@ local function nsieve(p, m)
   return count
 end
 
-local N = tonumber(arg and arg[1]) or 1
+local DEFAULT_N = 12
Why 12 instead of 1?
+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_fp",
+  payload = function()
+    local res = {}
+    local items = 0
+    for i=0,2 do
add more whitespaces
+      local m = (2^(N-i))*10000
add more whitespaces
+      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()
--------------oPBpwHaTgNpkprK1hMa063d6--