<!DOCTYPE html>
<html data-lt-installed="true">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body style="padding-bottom: 1px;">
    <p>Hi, Sergey!</p>
    <p>thanks for the patch!</p>
    <div class="moz-cite-prefix">On 10/24/25 13:50, Sergey Kaplun wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:7bed01339e183b7e57bda18130a61748b332c8d0.1761301736.git.skaplun@tarantool.org">
      <pre wrap="" class="moz-quote-pre">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 | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/perf/LuaJIT-benches/array3d.lua b/perf/LuaJIT-benches/array3d.lua
index c10b09b1..75ab5b01 100644
--- a/perf/LuaJIT-benches/array3d.lua
+++ b/perf/LuaJIT-benches/array3d.lua
@@ -1,3 +1,4 @@
+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 +51,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 in <a class="moz-txt-link-freetext" href="arr:points()">arr:points()</a> do
-  <a class="moz-txt-link-freetext" href="arr:set(x">arr:set(x</a>, 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)
+    return true
+  end,
+  payload = function()
+    local arr = array_new(dim, dim, dim, packed)
+    for x,y,z in <a class="moz-txt-link-freetext" href="arr:points()">arr:points()</a> do</pre>
    </blockquote>
    please add whitespaces after commas
    <blockquote type="cite"
cite="mid:7bed01339e183b7e57bda18130a61748b332c8d0.1761301736.git.skaplun@tarantool.org">
      <pre wrap="" class="moz-quote-pre">
+      <a class="moz-txt-link-freetext" href="arr:set(x">arr:set(x</a>, y, z, x*x)
+    end
+    return arr
+  end,
+  items = dim * dim * dim,
+  -- Limit the number of iterations to avoid OOM errors for
+  -- non-GC64 builds.
+  iterations = 5,
+})
 
+bench:run_and_report()</pre>
    </blockquote>
    <p>Looks like benchmark min time does not work as expected:</p>
    <p>[1] ~/sources/MRG/tarantool/third_party/luajit $ time
      ./build/src/luajit perf/LuaJIT-benches/array3d.lua
      --benchmark_min_time=10 <br>
-------------------------------------------------------------------------------------------------------------<br>
      Benchmark                                     Time           
       CPU    Iterations UserCounters...             <br>
-------------------------------------------------------------------------------------------------------------<br>
      array3d                                     2.10 s          2.13
      s             5 items_per_second=64.370M/s<br>
      <br>
      real    0m2.333s<br>
      user    0m1.869s<br>
      sys     0m0.461s<br>
      [1] ~/sources/MRG/tarantool/third_party/luajit $ <br>
    </p>
    <p>--benchmark_min_time set to 10 sec, but benchmark.lua reports "2.10
      s" and time reported by `time` utility</p>
    <p>is less than 10 sec.</p>
    <blockquote type="cite"
cite="mid:7bed01339e183b7e57bda18130a61748b332c8d0.1761301736.git.skaplun@tarantool.org">
      <pre wrap="" class="moz-quote-pre">
</pre>
    </blockquote>
  </body>
  <lt-container></lt-container>
</html>