From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 6D491518B06; Thu, 15 Jan 2026 13:02:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6D491518B06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1768471330; bh=hBpNvBqOje7WaYJr8OlmlxjUYbU4qvARO32g8pYZz/U=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=OSjX0eRCk0Xv34zf4wSa7JXYfVMJjCNAY7aAujWv2ykWTHPr4+HzNya85x1j+kG7O rUyoJH7khWTzl9QMcjsNRTM6Jbkxw/6BQcocZRCcIZmIRmNemEHiUSDFhqZGtUOmjJ nr1ubvbRxHcQFRafIV2n3O5rimBXe0E6mt3ygXik= Received: from send240.i.mail.ru (send240.i.mail.ru [95.163.59.79]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E1999162A7BF for ; Thu, 15 Jan 2026 13:02:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E1999162A7BF Received: by exim-smtp-55f9c6db88-x7twm with esmtpa (envelope-from ) id 1vgKB5-00000000Cky-3m6L; Thu, 15 Jan 2026 13:02:08 +0300 Date: Thu, 15 Jan 2026 13:02:19 +0300 To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Message-ID: References: <530b6b4fceaec1003a4f881b4ee3ef856d5385fe.1766738771.git.skaplun@tarantool.org> <0977f317-a619-4d97-980c-265876cc8339@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0977f317-a619-4d97-980c-265876cc8339@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD99B884C1B59F9AF802ED9356C6850F665437020655D58A793182A05F53808504046511124F867CCF93DE06ABAFEAF6705BD9D95E1D2EEEB54DB9FEB3446176FA086091FA637C0ECF9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7624C4D757C4F5837EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB5533756680939BF45BBEA69661D2B10D232467D6316B94E05A1A8CEAC93D19E7485C0E02389733CBF5DBD5E913377AFFFEAFD269A417C69337E82CC2CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481F9449624AB7ADAF372E808ACE2090B5E14AD6D5ED66289B5259CC434672EE63711DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C309A7649CC036878F35872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5DCBDE0696C5625A15002B1117B3ED696A5EE337CEAEBB7A8A9DAB4B68AE4D22F823CB91A9FED034534781492E4B8EEADA3FB0D9844EF8EC5BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE1918E10F71CB4DF9F96AB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659B84E71ED8AB43B7832D9D62DD8CE4A02B7F8A2D9C384A874252CD79D355C45998DE6F542AD5D747FB8341EE9D5BE9A0AAD1FF107E088EDB9C5EAF9352878C67BD83DE4E6E485DB2D8CD93680B12512CF4C41F94D744909CECFA6C6B0C050A61A8CAF69B82BA93681CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVVt0N+pdRHOZ4e0o+2cKOW4= X-Mailru-Sender: 689FA8AB762F7393DDD5FD59B456EAD20702B2E4D87EF9EDFAA7E8BE8D3A0EC93AB4733C69B4A647E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 luajit 03/41] perf: introduce bench module X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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: > > --- > > 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 > > + > > +-- 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. > > > + > > +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). > > > > + -- 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 > > + > > + -- 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 -- Best regards, Sergey Kaplun