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 BA22015D6597; Fri, 24 Oct 2025 13:56:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BA22015D6597 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1761303405; bh=AitmhYIVv64cJ1sGQKyYffvs1m5TZRThsvIvgwshYnY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=LMLeIUWLwJeDAAsQGlY2MUDVm0X7xMlGQs/0YjJhpx925RpZKKr676CG7++HD48hS y9xx4HbpdHIBhvPhHUbB6uNPRp1MIPlsks5cF6gxsqYrGncw9mafxgvd7EiYUw3Z4+ lyPBpLPZnHOx7SrCX+4tk5XG1eb/4IR44VUwMIRg= Received: from send103.i.mail.ru (send103.i.mail.ru [89.221.237.198]) (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 571111583A39 for ; Fri, 24 Oct 2025 13:51:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 571111583A39 Received: by exim-smtp-855f5997bb-88mr2 with esmtpa (envelope-from ) id 1vCFNr-000000006vv-0vLH; Fri, 24 Oct 2025 13:50:59 +0300 To: Sergey Bronnikov Date: Fri, 24 Oct 2025 13:50:16 +0300 Message-ID: <75a84e56bcbe64c8628c40633819b5314129788d.1761301736.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9DAB542EDD08389FE2B8DB0F4C44A02E277FD10E6CCCF5221182A05F5380850405E36B268A6C55E123DE06ABAFEAF6705FAB6369310D1A7F952E7C6720268728EE87099420498248C X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75DF2B1F23425CAE5EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637FE9EFE935CD7C6AE8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2C2DC468D75A947B02E070BE324C7D3C45DDAB68C54CBFA00F6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249E232F00D8D26902CA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA7E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B9A03B082221C895775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5099859E8F5C630EE5002B1117B3ED696746840EF4625B4DDC638DF663A625AFA823CB91A9FED034534781492E4B8EEAD2B25D9E4C92BC8ACC79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF5B79E19323E2D36663E487993A5E8A6D315DCAF6FD450B5E09DDA936DAB738B7F31E0254ADC75A066EB503EC62A3E87FED23B4A5CD899E00E2422C6CC32E61FED3CBA15F1E7C08B05F4332CA8FE04980913E6812662D5F2A5EAB5682573093F7837F15F2B5E4A70B33F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVRN2q9QiacRuhmD+LGkruPE= X-DA7885C5: 13DB13CC0294E67EF255D290C0D534F976BEACE3972AC9E66B207E07F4A7E1667DDE4CAE40B19EB55B1A4C17EAA7BC4BEF2421ABFA55128DAF83EF9164C44C7E X-Mailru-Sender: 689FA8AB762F7393DDD5FD59B456EAD2DC75541A4E50F9A511988E4495A63B6E266092CA650AEB10E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: [Tarantool-patches] [PATCH v1 luajit 12/41] perf: adjust life in LuaJIT-benches 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 Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch adjusts the aforementioned test to use the benchmark framework introduced before. The default arguments are adjusted according to the file. The output is redirected to /dev/null. The checker tests the result after the exact amount of iterations for the fixed field (as it is declared in the original benchmark). --- perf/LuaJIT-benches/life.lua | 79 +++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/perf/LuaJIT-benches/life.lua b/perf/LuaJIT-benches/life.lua index 911d9fe1..d0e4dc98 100644 --- a/perf/LuaJIT-benches/life.lua +++ b/perf/LuaJIT-benches/life.lua @@ -3,6 +3,8 @@ -- modified to use ANSI terminal escape sequences -- modified to use for instead of while +local bench = require('bench').new(arg) + local write=io.write ALIVE="¥" DEAD="þ" @@ -106,6 +108,81 @@ function LIFE(w,h) if gen>2000 then break end --delay() -- no delay end + return thisgen end -LIFE(40,20) +-- Result of the LIFE(40, 20) after 2000 generations. +--[[ +---------------------------------------- +---------------------------------------- +--OO--------------------------O--------- +-OO--------------------------O-O-------- +---O--------------------------O--------- +---------------------------------------- +---------------------------------------- +---------------------------------------- +---------------------------------------- +---------------------------------------- +---------------------------------------- +---------------------------------------- +---O------------------------------------ +--O-O----------------------------------- +--O-O----------------------------------- +---O------------------------------------ +---------------------------------------- +-------OO------------------------------- +-------OO------------------------------- +---------------------------------------- +]] + +local function check_life(thisgen, w, h) + local expected_cells = ARRAY2D(w, h) + for y = 1, h do + for x = 1, w do + expected_cells[y][x] = false + end + end + local alive_cells = { + {3, 3}, {3, 4}, {3, 31}, + {4, 2}, {4, 3}, {4, 30}, {4, 32}, + {5, 4}, {5, 31}, + {13, 4}, + {14, 3}, {14, 5}, + {15, 3}, {15, 5}, + {16, 4}, + {18, 8}, {18, 9}, + {19, 8}, {19, 9}, + } + for _, cell in ipairs(alive_cells) do + local y, x = cell[1], cell[2] + expected_cells[y][x] = true + end + for y = 1, h do + for x = 1, w do + assert(thisgen[y][x] > 0 == expected_cells[y][x], + ('Incorrect value for cell (%d, %d)'):format(x, y)) + end + end + return true +end + +local stdout = io.output() + +bench:add({ + name = 'life', + setup = function() + io.output('/dev/null') + end, + payload = function() + return LIFE(40, 20) + end, + teardown = function() + io.output(stdout) + end, + checker = function(res) + return check_life(res, 40, 20) + end, + items = 2000 * 40 * 20, +}) + +bench:run_and_report() -- 2.51.0