Tarantool development patches archive
 help / color / mirror / Atom feed
From: mechanik20051988 via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: v.shpilevoy@tarantool.org, alyapunov@tarantool.org
Cc: tarantool-patches@dev.tarantool.org,
	mechanik20051988 <mechanik20.05.1988@gmail.com>
Subject: [Tarantool-patches] [PATCH v2 1/5] test: add performance test for memtx allocator.
Date: Wed, 20 Jan 2021 10:53:39 +0300	[thread overview]
Message-ID: <29acbfeb3c9d3ea55585083e401c6adc7e85faab.1611073501.git.mechanik20051988@tarantool.org> (raw)
In-Reply-To: <cover.1611073501.git.mechanik20051988@tarantool.org>

From: mechanik20051988 <mechanik20.05.1988@gmail.com>

---
 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


  reply	other threads:[~2021-01-20  7:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20  7:53 [Tarantool-patches] [PATCH v2 0/5] Choose allocator for memtx mechanik20051988 via Tarantool-patches
2021-01-20  7:53 ` mechanik20051988 via Tarantool-patches [this message]
2021-01-20  7:53 ` [Tarantool-patches] [PATCH v2 2/5] memtx: changed some memtx files from .c to .cc mechanik20051988 via Tarantool-patches
2021-01-20  7:53 ` [Tarantool-patches] [PATCH v2 3/5] memtx: implement template tuple allocation mechanik20051988 via Tarantool-patches
2021-01-20  7:53 ` [Tarantool-patches] [PATCH v2 4/5] Implement system allocator, based on malloc mechanik20051988 via Tarantool-patches
2021-01-20  7:53 ` [Tarantool-patches] [PATCH v2 5/5] memtx: implement api for memory allocator selection mechanik20051988 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=29acbfeb3c9d3ea55585083e401c6adc7e85faab.1611073501.git.mechanik20051988@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=alyapunov@tarantool.org \
    --cc=mechanik20.05.1988@gmail.com \
    --cc=mechanik20051988@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 1/5] test: add performance test for memtx allocator.' \
    /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