From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp56.i.mail.ru (smtp56.i.mail.ru [217.69.128.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3D5504765E0 for ; Tue, 29 Dec 2020 14:03:38 +0300 (MSK) From: mechanik20051988 Date: Tue, 29 Dec 2020 14:03:29 +0300 Message-Id: <7d775b7475052a580be3511d61f3b9abd5c17a9a.1609239402.git.mechanik20051988@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/4] test: add performance test for memtx allocator. List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org, alyapunov@tarantool.org Cc: mechanik20051988 , tarantool-patches@dev.tarantool.org From: mechanik20051988 --- perf/allocator_perf.test.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 perf/allocator_perf.test.lua diff --git a/perf/allocator_perf.test.lua b/perf/allocator_perf.test.lua new file mode 100755 index 000000000..ffd217cdc --- /dev/null +++ b/perf/allocator_perf.test.lua @@ -0,0 +1,34 @@ +#!/usr/bin/env ../src/tarantool +os.execute('rm -rf *.snap *.xlog') +local clock = require('clock') +box.cfg{listen = 3301, wal_mode='none', allocator=arg[1]} +local space = box.schema.space.create('test') +space:format({ {name = 'id', type = 'unsigned'}, {name = 'year', type = 'unsigned'} }) +space:create_index('primary', { parts = {'id'} }) +local time_insert = 0 +local time_replace = 0 +local time_delete = 0 +local cnt = 0 +local cnt_max = 20 +local op_max = 2500000 +local nanosec = 1.0e9 +while cnt < cnt_max do + cnt = cnt + 1 + local time_before = clock.monotonic64() + for key = 1, op_max do space:insert({key, key + 1000}) end + local time_after = clock.monotonic64() + time_insert = time_insert + (time_after - time_before) + time_before = clock.monotonic64() + for key = 1, op_max do space:replace({key, key + 5000}) end + time_after = clock.monotonic64() + time_replace = time_replace + (time_after - time_before) + time_before = clock.monotonic64() + for key = 1, op_max do space:delete(key) end + time_after = clock.monotonic64() + time_delete = time_delete + (time_after - time_before) +end +io.write("{\n") +io.write(string.format(" \"alloc time\": \"%.3f\"\n", tonumber(time_insert) / (nanosec * cnt_max))) +io.write(string.format(" \"replace time\": \"%.3f\"\n", tonumber(time_replace) / (nanosec * cnt_max))) +io.write(string.format(" \"delete time\": \"%.3f\"\n}\n", tonumber(time_delete) / (nanosec * cnt_max))) +os.exit() -- 2.20.1