[Tarantool-patches] [PATCH v2 luajit 04/41] perf: adjust array3d in LuaJIT-benches

Sergey Bronnikov sergeyb at tarantool.org
Mon Dec 29 17:00:30 MSK 2025


Hi, Sergey!

LGTM with a minor comments.

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.
>
> The number of iterations is fixed for this test to avoid OOM errors
> for the non-GC64 builds.
> ---
>   perf/LuaJIT-benches/array3d.lua | 29 ++++++++++++++++++++++++-----
>   1 file changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/perf/LuaJIT-benches/array3d.lua b/perf/LuaJIT-benches/array3d.lua
> index c10b09b1..80562706 100644
> --- a/perf/LuaJIT-benches/array3d.lua
> +++ b/perf/LuaJIT-benches/array3d.lua
> @@ -1,3 +1,8 @@
> +-- The benchmark to measure simple operations on array-like data
> +-- structures.
> +-- Here, a 3D array is represented as a contiguous 1D array.
> +
> +local bench = require("bench").new(arg)
>   
>   local function array_set(self, x, y, z, p)
>     assert(x >= 0 and x < self.nx, "x outside PA")
> @@ -50,10 +55,24 @@ end
>   
>   local dim = tonumber(arg and arg[1]) or 300 -- Array dimension dim^3
>   local packed = arg and arg[2] == "packed"   -- Packed image or flat
> -local arr = array_new(dim, dim, dim, packed)
>   
> -for x,y,z inarr:points() do
> -arr:set(x, y, z, x*x)
> -end
> -assert(arr.image[dim^3-1] == (dim-1)^2)
> +bench:add({
> +  name = "array3d",
> +  checker = function(arr)
> +    assert(arr.image[dim^3-1] == (dim-1)^2)
Please add more whitespaces.
> +    return true
> +  end,
> +  payload = function()
> +    local arr = array_new(dim, dim, dim, packed)
> +    for x, y, z inarr:points() do
> +arr:set(x, y, z, x*x)
s/x*x/x * x/
> +    end
> +    return arr
> +  end,
> +  items = dim * dim * dim,
> +  -- Limit the number of iterations to avoid OOM errors for
> +  -- non-GC64 builds.
> +  iterations = 4,
> +})
>   
> +bench:run_and_report()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20251229/07328c41/attachment.htm>


More information about the Tarantool-patches mailing list