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 16FCF16354A6; Thu, 13 Nov 2025 14:17:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 16FCF16354A6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1763032648; bh=h/7rjEpCPJg+wkFD5lWT355Wn73P/omSCL83Eq26aMY=; 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=tYloOB/6fIOnhdWvRLr5Qcrw08i+YXua8P7sShkHDn/9EYb1s+crA7dOR+NBEckON HDLx1SLP3+CFxOX/d1khSWs/tyclOfDoktpg3E0A61c7OT4iNQYoGqD2m4D5O3cPHo yOnhPbNU3XnGutHXKG7EDHKQIDR6TrhBMt2POWho= Received: from send175.i.mail.ru (send175.i.mail.ru [95.163.59.14]) (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 0D51716354A3 for ; Thu, 13 Nov 2025 14:17:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0D51716354A3 Received: by exim-smtp-68c8686b96-82qfp with esmtpa (envelope-from ) id 1vJVKQ-00000000RIr-03v5; Thu, 13 Nov 2025 14:17:26 +0300 Content-Type: multipart/alternative; boundary="------------CxCReIFTeZKVFc745plrqkTi" Message-ID: Date: Thu, 13 Nov 2025 14:17:20 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <7b761c35d6f2126d36a1d6057fb59b1020b53b99.1761301736.git.skaplun@tarantool.org> In-Reply-To: <7b761c35d6f2126d36a1d6057fb59b1020b53b99.1761301736.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD979CE446CE8475ACDCF9E6C201C025A835F760AE77787C03900894C459B0CD1B9A0631B92BB54F51B03AAE3001806DF10A52664BD73AB7663DA8C1B89F200BF6221323E01452AE1F2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE728306843C9CFCFEAEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637FE9EFE935CD7C6AE8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2424CFD80CD7A8B5F2E070BE324C7D3C49D6446A16F2D2A2EF6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249D082881546D93491CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0A3E989B1926288338941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C0BCF2C0F5768D5B7A7B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F9647ADFADE5905B103CEA74F0D118906B3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B9EB32FE0C26A3A4C75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5D3447AD3EBE0E5A55002B1117B3ED696935CF181154BC57CFB820E9FE7BD014C823CB91A9FED034534781492E4B8EEAD9CFA8CFAC159CE19BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFF71A0B18C7AC7775C9BC235E622B18F7BCBE2579B2A73192B0CB1F68C72124A3506ED036F265C542D57337E961690FE2D367F3223FB779D8A0CC6BB1BD4BB5984DFFF1A974FEDEBA111DC66A97D0BFE2913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVfFX+FmbwDW1pC8hnFE2bu4= X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B59BDCFB4A19CA6BF573DE06ABAFEAF67058A15EE1A925F6841B7CBEF92542CD7C8795FA72BAB74744FC77752E0C033A69EA16A481184E8BB1C9B38E6EA4F046BE03A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 luajit 07/41] perf: adjust coroutine-ring 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. --------------CxCReIFTeZKVFc745plrqkTi 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/coroutine-ring.lua | 45 ++++++++++++++++---------- > 1 file changed, 28 insertions(+), 17 deletions(-) > > diff --git a/perf/LuaJIT-benches/coroutine-ring.lua b/perf/LuaJIT-benches/coroutine-ring.lua > index 1e8c5ef6..1b86a5ba 100644 > --- a/perf/LuaJIT-benches/coroutine-ring.lua > +++ b/perf/LuaJIT-benches/coroutine-ring.lua > @@ -1,3 +1,5 @@ > +local bench = require("bench").new(arg) > + > -- The Computer Language Benchmarks Game > --http://shootout.alioth.debian.org/ > -- contributed by Sam Roberts > @@ -7,7 +9,6 @@ local n = tonumber(arg and arg[1]) or 2e7 > > -- fixed size pool > local poolsize = 503 > -local threads = {} > > -- cache these to avoid global environment lookups > local create = coroutine.create > @@ -15,7 +16,6 @@ local resume = coroutine.resume > local yield = coroutine.yield > > local id = 1 > -local token = 0 > local ok > > local body = function(token) > @@ -24,19 +24,30 @@ local body = function(token) > end > end > > --- create all threads > -for id = 1, poolsize do > - threads[id] = create(body) > -end > - > --- send the token > -repeat > - if id == poolsize then > - id = 1 > - else > - id = id + 1 > - end > - ok, token = resume(threads[id], token) > -until token == n > +bench:add({ > + name = "coroutine_ring", > + payload = function() > + local token = 0 a single whitespace before "=" > + -- create all threads First letter is in uppercase and a dot at the end. > + local threads = {} a single whitespace before "=" > + for id = 1, poolsize do > + threads[id] = create(body) > + end > + > + -- send the token First letter is in uppercase and a dot at the end. > + repeat > + if id == poolsize then > + id = 1 > + else > + id = id + 1 > + end > + ok, token = resume(threads[id], token) > + until token == n > + return id > + end, > + checker = function(id) return id == (n % poolsize + 1) end, > + items = n, > +}) > + > +bench:run_and_report() > > -io.write(id, "\n") --------------CxCReIFTeZKVFc745plrqkTi 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/coroutine-ring.lua | 45 ++++++++++++++++----------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/perf/LuaJIT-benches/coroutine-ring.lua b/perf/LuaJIT-benches/coroutine-ring.lua
index 1e8c5ef6..1b86a5ba 100644
--- a/perf/LuaJIT-benches/coroutine-ring.lua
+++ b/perf/LuaJIT-benches/coroutine-ring.lua
@@ -1,3 +1,5 @@
+local bench = require("bench").new(arg)
+
 -- The Computer Language Benchmarks Game
 -- http://shootout.alioth.debian.org/
 -- contributed by Sam Roberts
@@ -7,7 +9,6 @@ local n         = tonumber(arg and arg[1]) or 2e7
 
 -- fixed size pool
 local poolsize  = 503
-local threads   = {}
 
 -- cache these to avoid global environment lookups
 local create    = coroutine.create
@@ -15,7 +16,6 @@ local resume    = coroutine.resume
 local yield     = coroutine.yield
 
 local id        = 1
-local token     = 0
 local ok
 
 local body = function(token)
@@ -24,19 +24,30 @@ local body = function(token)
   end
 end
 
--- create all threads
-for id = 1, poolsize do
-  threads[id] = create(body)
-end
-
--- send the token
-repeat
-  if id == poolsize then
-    id = 1
-  else
-    id = id + 1
-  end
-  ok, token = resume(threads[id], token)
-until token == n
+bench:add({
+  name = "coroutine_ring",
+  payload = function()
+    local token     = 0
a single whitespace before "="
+    -- create all threads
First letter is in uppercase and a dot at the end.
+    local threads   = {}
a single whitespace before "="
+    for id = 1, poolsize do
+      threads[id] = create(body)
+    end
+
+    -- send the token
First letter is in uppercase and a dot at the end.
+    repeat
+      if id == poolsize then
+        id = 1
+      else
+        id = id + 1
+      end
+      ok, token = resume(threads[id], token)
+    until token == n
+    return id
+  end,
+  checker = function(id) return id == (n % poolsize + 1) end,
+  items = n,
+})
+
+bench:run_and_report()
 
-io.write(id, "\n")
--------------CxCReIFTeZKVFc745plrqkTi--