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 D5C0016862C4; Tue, 23 Dec 2025 13:44:49 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D5C0016862C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1766486690; bh=q+wyAAEHjDxYYrL9rFnHwgBsQy4l170zpYJGItKXiTM=; 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=kwLfxbNQ7g/E3VI16CUI29LPr8yQpbNBKuCKTcPmCTi7wmRvJbBTqLVEmHedI8QwJ fZSX0J0r5xKhpQS12gPrfw3TYZ9wx/yCSmZwLhU6K40IcypQICkK63pvD7p4MmCFqQ DocsY3nFUCB850Ju2A4gfmAvlCSMfTd6eLnipTD0= 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 C1E5216862C4 for ; Tue, 23 Dec 2025 13:44:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C1E5216862C4 Received: by exim-smtp-7b4fb89df9-9g64g with esmtpa (envelope-from ) id 1vXzsl-000000008dJ-1TLv; Tue, 23 Dec 2025 13:44:47 +0300 Content-Type: multipart/alternative; boundary="------------S6H3LkVu0jp9fojgqXhxV0GY" Message-ID: <33468b50-1c47-4a3f-969d-c43ccacb577a@tarantool.org> Date: Tue, 23 Dec 2025 13:44:47 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <5fb7539d5539b29ed416c83a3ec413c5032c99ab.1761301736.git.skaplun@tarantool.org> In-Reply-To: <5fb7539d5539b29ed416c83a3ec413c5032c99ab.1761301736.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9482F28CFCE3EB4D7B65F8DC9963E9CCF2DFDC9F66A84705C1313CFAB8367EF908E2BE116634AD74D68D30C8883FAA6D0C7A4B249DE6549FDC1C53E9E4789D49C2B3D91EB1BE779A4B04C393452CF6677 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BCC85671EC7A750CEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566EF210049E62C3CC50D6D4928A494F53873BB8E683AFC8CB0EC80D513CDD579ED389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C0A3E989B1926288338941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B65FF0BFC5AEE34BE6CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C224958C1606C78F2434E76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8B6A4E49BB0F3BA1413AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735458315FA5AE40766C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A597A5EA65EC2BC36D5002B1117B3ED696F3E905146BEACA71CA7E60A991436CA2823CB91A9FED034534781492E4B8EEAD85CCBA673D36D1A4BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE1918E10F71CB4DF9F96AB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659A7E7E7B896C67661253EA321E93626EB0B93DB5D1CCF16BEA0E2CB66132C2C4A5BB9D5B899AADACCB8341EE9D5BE9A0A27AC4083DED4EE9BCB7823B376064C2FB357BECCA6EFFC828CD93680B12512CF4C41F94D744909CE2512F26BEC029E55448553D2254B8D95CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVdtTL5f5BIXbofUAdgoSMfw= X-Mailru-Sender: 811C44EDE0507D1FFB106D83BFFB684FE729D51A8A4ADEF4CFE9FA76EDA5B4B7606745CDD40DA52D8AAFE5A91B55506C645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 luajit 36/41] perf: adjust sum-file 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. --------------S6H3LkVu0jp9fojgqXhxV0GY Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit on execution I got an error: ./build/src/luajit: perf/LuaJIT-benches/sum-file.lua:11: attempt to perform arithmetic on local 'line' (a string value) On 10/24/25 14:00, 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. > > The input for the test is redirected from the generated file > . This file is the result of concatenation of the > 5000 times. > --- > perf/LuaJIT-benches/sum-file.lua | 29 ++++++++++++++++++++++++----- > 1 file changed, 24 insertions(+), 5 deletions(-) > > diff --git a/perf/LuaJIT-benches/sum-file.lua b/perf/LuaJIT-benches/sum-file.lua > index c9e618fd..270c1865 100644 > --- a/perf/LuaJIT-benches/sum-file.lua > +++ b/perf/LuaJIT-benches/sum-file.lua > @@ -1,6 +1,25 @@ > +local bench = require("bench").new(arg) > > -local sum = 0 > -for line in io.lines() do > - sum = sum + line > -end > -io.write(sum, "\n") > +-- XXX: The input file is generated from by > +-- repeating it 5000 times. The contains 1000 lines > +-- with the total sum of 500. > +bench:add({ > + name = "sum_file", > + payload = function() > + local sum = 0 > + for line in io.lines() do > + sum = sum + line You obviously cannot sum a string and a number. > + end > + -- Allow several iterations. > +io.stdin:seek("set", 0) > + return sum > + end, > + checker = function(res) > + -- Precomputed result. > + return res == 2500000 > + end, > + -- Fixed size of the file. > + items = 5e6, > +}) > + > +bench:run_and_report() --------------S6H3LkVu0jp9fojgqXhxV0GY Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

on execution I got an error:

./build/src/luajit: perf/LuaJIT-benches/sum-file.lua:11: attempt to perform arithmetic on local 'line' (a string value)

On 10/24/25 14:00, 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.

The input for the test is redirected from the generated file
<SUMCOL_5000.txt>. This file is the result of concatenation of the
<SUMCOL_1.txt> 5000 times.
---
 perf/LuaJIT-benches/sum-file.lua | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/perf/LuaJIT-benches/sum-file.lua b/perf/LuaJIT-benches/sum-file.lua
index c9e618fd..270c1865 100644
--- a/perf/LuaJIT-benches/sum-file.lua
+++ b/perf/LuaJIT-benches/sum-file.lua
@@ -1,6 +1,25 @@
+local bench = require("bench").new(arg)
 
-local sum = 0
-for line in io.lines() do
-  sum = sum + line
-end
-io.write(sum, "\n")
+-- XXX: The input file is generated from <SUMCOL_1.txt> by
+-- repeating it 5000 times. The <SUMCOL_1.txt> contains 1000 lines
+-- with the total sum of 500.
+bench:add({
+  name = "sum_file",
+  payload = function()
+    local sum = 0
+    for line in io.lines() do
+      sum = sum + line
You obviously cannot sum a string and a number.
+    end
+    -- Allow several iterations.
+    io.stdin:seek("set", 0)
+    return sum
+  end,
+  checker = function(res)
+    -- Precomputed result.
+    return res == 2500000
+  end,
+  -- Fixed size of the file.
+  items = 5e6,
+})
+
+bench:run_and_report()
--------------S6H3LkVu0jp9fojgqXhxV0GY--