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 CB0B416AFFD7; Fri, 26 Dec 2025 12:24:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org CB0B416AFFD7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1766741063; bh=EwtI1+oILRXM3G71NtqhulriY3Co3L3zLWVYx2bE9qc=; 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=plaF/3L6nP6zsUokdthfU6qwGJWnW2rOmr5/vRfcS0Dx4tC8INjArEtDqjhUMVgyt Rl+hD0fNNkMWR70ISs26X+8l2rxI+lXpHw79UpX1fVJonS16Jim2fXMvoAOsaPD1AH 9L/FA0SklQrr9tonkYQm3KMmn7kmW3Ujk6oKVCFQ= Received: from send174.i.mail.ru (send174.i.mail.ru [95.163.59.13]) (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 3682816C6586 for ; Fri, 26 Dec 2025 12:18:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3682816C6586 Received: by exim-smtp-7b4fb89df9-lft7n with esmtpa (envelope-from ) id 1vZ3xy-000000008Cp-0TBZ; Fri, 26 Dec 2025 12:18:34 +0300 To: Sergey Bronnikov Date: Fri, 26 Dec 2025 12:17:43 +0300 Message-ID: <3d7e6442ea25d89184fce87709e0fb01998de48b.1766738771.git.skaplun@tarantool.org> X-Mailer: git-send-email 2.52.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: 4F1203BC0FB41BD979975AF0D777FEBDA796860CCD9352B78452F76EDBE9CB18182A05F5380850400A9E92CD51A9D4863DE06ABAFEAF6705491FC0CA8520E6B1B4FA2C6BBBE99EF9ACCB5262BB541CA2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7BF6702EC5472AA0FEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566657B88B02DF8C8695068ED56C9FD46E58EDCD39A7D089D1A1A4F4C286F6E8550389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07734D68A6916D8318941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B6AEEA5BB16A939343CC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB86D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE79E9721B410A3B6ED731C566533BA786AA5CC5B56E945C8DA X-C1DE0DAB: 0D63561A33F958A53D661EF4D507EA125002B1117B3ED69643376174373F1A7D5D145BB8EF0DE66B823CB91A9FED034534781492E4B8EEAD85CCBA673D36D1A4C79554A2A72441328621D336A7BC284946AD531847A6065A535571D14F44ED41 X-C8649E89: 1C3962B70DF3F0AD73CAD6646DEDE1918E10F71CB4DF9F96AB70F9BE574AE9C625B6776AC983F447FC0B9F89525902EE6F57B2FD27647F25E66C117BDB76D659D60F373F6DFF523187F6CB774006C5B37A9C2D24546802BF67F7B87D9DE3EFD1BE411541139B383AB8341EE9D5BE9A0A1E927452D69BCC5605D8439B09F6DFF017B462C2FBC1B5866536EB022892E5344C41F94D744909CECFA6C6B0C050A61A8CAF69B82BA93681CD72808BE417F3B9E0E7457915DAA85F X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVdtTL5f5BIXbZeNKIuAqdRU= X-Mailru-Sender: 689FA8AB762F7393DDD5FD59B456EAD2D360B39269BA51E98700636FE984EBB8F8C3866AE29871A3E49D44BB4BD9522A059A1ED8796F048DB274557F927329BE89D5A3BC2B10C37545BD1C3CC395C826B4A721A3011E896F X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 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 | 89 ++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 3 deletions(-) diff --git a/perf/LuaJIT-benches/life.lua b/perf/LuaJIT-benches/life.lua index 911d9fe1..dbf26fac 100644 --- a/perf/LuaJIT-benches/life.lua +++ b/perf/LuaJIT-benches/life.lua @@ -1,11 +1,19 @@ -- life.lua --- original by Dave Bollinger posted to lua-l +-- The benchmark to check the performance of array-like data +-- structures with RW access. John Horton Conway's "Game of Life" +-- cellular automaton. +-- For the details see: +-- https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life +-- Original by Dave Bollinger posted +-- to lua-l: +-- http://lua-users.org/lists/lua-l/1999-12/msg00003.html -- 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="þ" ALIVE="O" DEAD="-" function delay() -- NOTE: SYSTEM-DEPENDENT, adjust as necessary @@ -106,6 +114,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.52.0