Hi, Sergey! thanks for the patch! LGTM 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/chameneos.lua | 32 ++++++++++++++++++++++--------- > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/perf/LuaJIT-benches/chameneos.lua b/perf/LuaJIT-benches/chameneos.lua > index 78b64c3f..c1002041 100644 > --- a/perf/LuaJIT-benches/chameneos.lua > +++ b/perf/LuaJIT-benches/chameneos.lua > @@ -1,8 +1,10 @@ > +local bench = require("bench").new(arg) > > local co = coroutine > local create, resume, yield = co.create, co.resume, co.yield > > -local N = tonumber(arg and arg[1]) or 10 > +local N = tonumber(arg and arg[1]) or 1e7 Why 1e7? > +local N_ATTEMPTS = N > local first, second > > -- Meet another creature. > @@ -57,12 +59,24 @@ local function schedule(threads) > until false > end > > --- A bunch of colorful creatures. > -local threads = { > - creature("blue"), > - creature("red"), > - creature("yellow"), > - creature("blue"), > -} > +bench:add({ > + name = "chameneos", > + items = N_ATTEMPTS, > + checker = function(meetings) return meetings == N_ATTEMPTS * 2 end, > + payload = function() > + -- A bunch of colorful creatures. > + local threads = { > + creature("blue"), > + creature("red"), > + creature("yellow"), > + creature("blue"), > + } > > -io.write(schedule(threads), "\n") > + local meetings = schedule(threads) > + -- XXX: Restore meetings for the next iteration. > + N = N_ATTEMPTS > + return meetings > + end, > +}) > + > +bench:run_and_report()