Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Bronnikov <sergeyb@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 luajit 03/41] perf: introduce bench module
Date: Thu, 15 Jan 2026 13:02:19 +0300	[thread overview]
Message-ID: <aWi7K98ap2tHm71Q@root> (raw)
In-Reply-To: <0977f317-a619-4d97-980c-265876cc8339@tarantool.org>

Hi, Sergey!
Thanks for the comments!
Please see my answers below.

On 15.01.26, Sergey Bronnikov wrote:
> Hi, Sergey,
> 
> thanks for the patch! LGTM with minor comments.
> 
> Sergey
> 
> On 12/26/25 12:17, Sergey Kaplun wrote:

<snipped>

> > ---
> >   perf/utils/bench.lua | 511 +++++++++++++++++++++++++++++++++++++++++++
> >   1 file changed, 511 insertions(+)
> >   create mode 100644 perf/utils/bench.lua
> >
> > diff --git a/perf/utils/bench.lua b/perf/utils/bench.lua
> > new file mode 100644
> > index 00000000..09a5c41a
> > --- /dev/null
> > +++ b/perf/utils/bench.lua

<snipped>

> > +
> > +-- Process the options and update the benchmark context.
> > +local function argparse(arg, name)
> > +  local ctx = {name = name}
> 
> You format test output and column with test name has a fixed length,
> 
> I would check a test name for max len:
> 
> diff --git a/perf/utils/bench.lua b/perf/utils/bench.lua
> index 09a5c41a..f3557347 100644
> --- a/perf/utils/bench.lua
> +++ b/perf/utils/bench.lua
> @@ -190,8 +190,11 @@ local function parse_opt(ctx, arg, a, n)
>     end
>   end
> 
> +local MAX_TEST_NAME_LEN = 37
> +
>   -- Process the options and update the benchmark context.
>   local function argparse(arg, name)
> +  assert(#name > MAX_TEST_NAME_LEN)

It is not the required length, but more like an alignment
restriction.

| $ luajit -e 'print(("%-3s %d"):format("aaaaa", 1))'
| aaaaa 1
| $ luajit -e 'print(("%-3s %d"):format("aa", 1))'
| aa  1

>     local ctx = {name = name}
>     local n = 1
>     while n <= #arg do
> @@ -212,8 +215,8 @@ end
>   local function format_console_header()
>     -- Use a similar format to the Google Benchmark, except for the
>     -- fixed benchmark name length.
> -  local header = format('%-37s %12s %15s %13s %-28s\n',
> -    'Benchmark', 'Time', 'CPU', 'Iterations', 'UserCounters...'
> +  local header = format('%-%ds %12s %15s %13s %-28s\n',
> +    MAX_TEST_NAME_LEN, 'Benchmark', 'Time', 'CPU', 'Iterations', 
> 'UserCounters...'
>     )
>     local border = rep('-', #header - 1) .. '\n'
>     return border .. header .. border
> @@ -226,7 +229,7 @@ local COLORS = {
>   }
> 
>   local function format_name(ctx, name)
> -  name = format('%-37s ', name)
> +  name = format('%-%ds ', MAX_TEST_NAME_LEN, name)
>     if ctx.color then
>        name = format(COLORS.GREEN, name)
>     end
> 
> Feel free to ignore.

This requires to format the format string, so it looks not very
readable: `format(format("%%%-%ds "), name)`
Ignoring.

> 

<snipped>

> > +
> > +local COLORS = {
> > +  GREEN = '\027[32m%s\027[m',
> > +  YELLOW = '\027[33m%s\027[m',
> > +  CYAN = '\027[36m%s\027[m',
> > +}
> > +
> 
> Minor: we can sort it alphabetically:
> 
> 
>   local COLORS = {
> +  CYAN = '\027[36m%s\027[m',
>     GREEN = '\027[32m%s\027[m',
>     YELLOW = '\027[33m%s\027[m',
> -  CYAN = '\027[36m%s\027[m',
>   }

I prefer to sort in the code numbers order (as it is usually done in any
listings).

> 
> 

<snipped>

> > +  -- Reset the GC to the defaults.
> > +  collectgarbage('setstepmul', 200)
> > +  collectgarbage('setpause', 200)
> We don't change these parameters in bench.lua, why should we reset to 
> defaults?

In the case if user changes them during the benchmark.

> > +
> > +  -- Collect all garbage at the end. Twice to be sure that all
> > +  -- finalizers are run.
> > +  collectgarbage()
> > +  collectgarbage()
> > +end
> > +

<snipped>

> > +      -- Iterations are determined dinamycally, adjusting to fit
> typo: s/dinamycally/dynamycally/

Fixed, thanks!

===================================================================
diff --git a/perf/utils/bench.lua b/perf/utils/bench.lua
index 09a5c41a..0f1b2898 100644
--- a/perf/utils/bench.lua
+++ b/perf/utils/bench.lua
@@ -452,7 +452,7 @@ local function run_benches(ctx)
       delta_real = clock.realtime() - start_real
       delta_cpu  = clock.process_cputime() - start_cpu
     else
-      -- Iterations are determined dinamycally, adjusting to fit
+      -- Iterations are determined dynamycally, adjusting to fit
       -- the minimum time to run for the benchmark.
       local min_time = bench.min_time or ctx.min_time
       local next_iterations = 1
===================================================================

Branch is force-pushed.

> > +      -- the minimum time to run for the benchmark.
> > +      local min_time = bench.min_time or ctx.min_time
> > +      local next_iterations = 1

<snipped>

-- 
Best regards,
Sergey Kaplun

  reply	other threads:[~2026-01-15 10:02 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-26  9:17 [Tarantool-patches] [PATCH v2 luajit 00/41] LuaJIT performance testing Sergey Kaplun via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 01/41] perf: add LuaJIT-test-cleanup perf suite Sergey Kaplun via Tarantool-patches
2025-12-29 13:28   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 02/41] perf: introduce clock module Sergey Kaplun via Tarantool-patches
2025-12-29 13:55   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:16     ` Sergey Kaplun via Tarantool-patches
2026-01-13 15:06       ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 03/41] perf: introduce bench module Sergey Kaplun via Tarantool-patches
2026-01-15  8:49   ` Sergey Bronnikov via Tarantool-patches
2026-01-15 10:02     ` Sergey Kaplun via Tarantool-patches [this message]
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 04/41] perf: adjust array3d in LuaJIT-benches Sergey Kaplun via Tarantool-patches
2025-12-29 14:00   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:20     ` Sergey Kaplun via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 05/41] perf: adjust binary-trees " Sergey Kaplun via Tarantool-patches
2025-12-29 14:04   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 06/41] perf: adjust chameneos " Sergey Kaplun via Tarantool-patches
2025-12-29 14:18   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 07/41] perf: adjust coroutine-ring " Sergey Kaplun via Tarantool-patches
2025-12-29 14:10   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 08/41] perf: adjust euler14-bit " Sergey Kaplun via Tarantool-patches
2025-12-29 14:15   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 09/41] perf: adjust fannkuch " Sergey Kaplun via Tarantool-patches
2025-12-29 14:17   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 10/41] perf: adjust fasta " Sergey Kaplun via Tarantool-patches
2026-01-15  8:07   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 11/41] perf: adjust k-nucleotide " Sergey Kaplun via Tarantool-patches
2026-01-02 10:03   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:38     ` Sergey Kaplun via Tarantool-patches
2026-01-13 15:39       ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 12/41] perf: adjust life " Sergey Kaplun via Tarantool-patches
2026-01-02 10:07   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 13/41] perf: adjust mandelbrot-bit " Sergey Kaplun via Tarantool-patches
2026-01-02 10:10   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 14/41] perf: adjust mandelbrot " Sergey Kaplun via Tarantool-patches
2026-01-02 10:12   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 15/41] perf: adjust md5 " Sergey Kaplun via Tarantool-patches
2026-01-02 10:15   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 16/41] perf: adjust meteor " Sergey Kaplun via Tarantool-patches
2026-01-02 10:18   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 17/41] perf: adjust nbody " Sergey Kaplun via Tarantool-patches
2026-01-02 10:55   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:21     ` Sergey Kaplun via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 18/41] perf: adjust nsieve-bit-fp " Sergey Kaplun via Tarantool-patches
2026-01-15  7:58   ` Sergey Bronnikov via Tarantool-patches
2026-01-15  8:04     ` Sergey Kaplun via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 19/41] perf: adjust nsieve-bit " Sergey Kaplun via Tarantool-patches
2026-01-02 10:57   ` Sergey Bronnikov via Tarantool-patches
2026-01-02 11:00   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 20/41] perf: adjust nsieve " Sergey Kaplun via Tarantool-patches
2026-01-02 11:01   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 21/41] perf: adjust partialsums " Sergey Kaplun via Tarantool-patches
2026-01-02 11:04   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 22/41] perf: adjust pidigits-nogmp " Sergey Kaplun via Tarantool-patches
2026-01-02 11:07   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 23/41] perf: adjust ray " Sergey Kaplun via Tarantool-patches
2026-01-02 11:08   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 24/41] perf: adjust recursive-ack " Sergey Kaplun via Tarantool-patches
2026-01-02 15:25   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 25/41] perf: adjust recursive-fib " Sergey Kaplun via Tarantool-patches
2026-01-02 15:31   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 26/41] perf: adjust revcomp " Sergey Kaplun via Tarantool-patches
2026-01-02 15:37   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:28     ` Sergey Kaplun via Tarantool-patches
2026-01-13 15:37       ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 27/41] perf: adjust scimark-2010-12-20 " Sergey Kaplun via Tarantool-patches
2026-01-02 15:53   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:10     ` Sergey Kaplun via Tarantool-patches
2025-12-26  9:17 ` [Tarantool-patches] [PATCH v2 luajit 28/41] perf: move <scimark_lib.lua> to <libs/> directory Sergey Kaplun via Tarantool-patches
2026-01-13 15:05   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 29/41] perf: adjust scimark-fft in LuaJIT-benches Sergey Kaplun via Tarantool-patches
2026-01-02 15:58   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:07     ` Sergey Kaplun via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 30/41] perf: adjust scimark-lu " Sergey Kaplun via Tarantool-patches
2026-01-02 16:01   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:06     ` Sergey Kaplun via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 31/41] perf: add scimark-mc " Sergey Kaplun via Tarantool-patches
2026-01-02 16:03   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:05     ` Sergey Kaplun via Tarantool-patches
2026-01-13 15:34       ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 32/41] perf: adjust scimark-sor " Sergey Kaplun via Tarantool-patches
2026-01-02 16:06   ` Sergey Bronnikov via Tarantool-patches
2026-01-03  6:04     ` Sergey Kaplun via Tarantool-patches
2026-01-13 15:34       ` Sergey Bronnikov via Tarantool-patches
2026-01-02 16:27   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 33/41] perf: adjust scimark-sparse " Sergey Kaplun via Tarantool-patches
2026-01-02 16:27   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 34/41] perf: adjust series " Sergey Kaplun via Tarantool-patches
2026-01-02 16:32   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 35/41] perf: adjust spectral-norm " Sergey Kaplun via Tarantool-patches
2026-01-02 16:32   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 36/41] perf: adjust sum-file " Sergey Kaplun via Tarantool-patches
2026-01-13 14:45   ` Sergey Bronnikov via Tarantool-patches
2026-01-13 14:47   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 37/41] perf: add CMake infrastructure Sergey Kaplun via Tarantool-patches
2026-01-13 15:04   ` Sergey Bronnikov via Tarantool-patches
2026-01-14  8:50     ` Sergey Kaplun via Tarantool-patches
2026-01-15  7:47       ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 38/41] perf: add aggregator helper for bench statistics Sergey Kaplun via Tarantool-patches
2026-01-13 15:33   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 39/41] perf: add a script for the environment setup Sergey Kaplun via Tarantool-patches
2026-01-13 15:31   ` Sergey Bronnikov via Tarantool-patches
2026-01-13 15:46     ` Sergey Kaplun via Tarantool-patches
2026-01-15  7:52       ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 40/41] perf: provide CMake option to setup the benchmark Sergey Kaplun via Tarantool-patches
2026-01-13 15:30   ` Sergey Bronnikov via Tarantool-patches
2025-12-26  9:18 ` [Tarantool-patches] [PATCH v2 luajit 41/41] ci: introduce the performance workflow Sergey Kaplun via Tarantool-patches
2026-01-13 15:30   ` Sergey Bronnikov via Tarantool-patches
2026-01-14 10:19     ` Sergey Kaplun via Tarantool-patches
2026-01-15  7:52       ` Sergey Bronnikov via Tarantool-patches
2026-01-15 12:28 ` [Tarantool-patches] [PATCH v2 luajit 00/41] LuaJIT performance testing Sergey Bronnikov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aWi7K98ap2tHm71Q@root \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 luajit 03/41] perf: introduce bench module' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox