Hi, Sergey! thanks for the patch! LGTM Sergey On 12/26/25 12:18, 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 | 33 +++++++++++++++++++++++++++----- > 1 file changed, 28 insertions(+), 5 deletions(-) > > diff --git a/perf/LuaJIT-benches/sum-file.lua b/perf/LuaJIT-benches/sum-file.lua > index c9e618fd..6af2b4a5 100644 > --- a/perf/LuaJIT-benches/sum-file.lua > +++ b/perf/LuaJIT-benches/sum-file.lua > @@ -1,6 +1,29 @@ > +-- The benchmark to check the performance of reading lines from > +-- stdin and sum the given numbers (the strings converted to > +-- numbers by the VM automatically). > > -local sum = 0 > -for line in io.lines() do > - sum = sum + line > -end > -io.write(sum, "\n") > +local bench = require("bench").new(arg) > + > +-- 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 > + 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()