[Tarantool-patches] [PATCH v2 luajit 06/41] perf: adjust chameneos in LuaJIT-benches
Sergey Bronnikov
sergeyb at tarantool.org
Mon Dec 29 17:18:36 MSK 2025
Hi, Sergey!
thanks for the patch! LGTM
Sergey
On 12/26/25 12:17, 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/chameneos.lua | 38 +++++++++++++++++++++++--------
> 1 file changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/perf/LuaJIT-benches/chameneos.lua b/perf/LuaJIT-benches/chameneos.lua
> index 78b64c3f..9bd83081 100644
> --- a/perf/LuaJIT-benches/chameneos.lua
> +++ b/perf/LuaJIT-benches/chameneos.lua
> @@ -1,8 +1,16 @@
> +-- The benchmark to check the performance of coroutine interaction
> +-- using symmetrical rendezvous requests.
> +-- For the details see:
> +--https://pybenchmarks.org/u64q/performance.php?test=chameneosredux
> +--https://cedric.cnam.fr/PUBLIS/RC474.pdf
> +
> +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
> +local N_ATTEMPTS = N
> local first, second
>
> -- Meet another creature.
> @@ -57,12 +65,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"),
> + }
> +
> + local meetings = schedule(threads)
> + -- XXX: Restore meetings for the next iteration.
> + N = N_ATTEMPTS
> + return meetings
> + end,
> +})
>
> -io.write(schedule(threads), "\n")
> +bench:run_and_report()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20251229/698fc339/attachment.htm>
More information about the Tarantool-patches
mailing list