File: tuple_bench.test.lua

package info (click to toggle)
tarantool 2.6.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 85,412 kB
  • sloc: ansic: 513,775; cpp: 69,493; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,178; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (32 lines) | stat: -rw-r--r-- 931 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
build_path = os.getenv("BUILDDIR")
package.cpath = build_path..'/test/box/?.so;'..build_path..'/test/box/?.dylib;'..package.cpath

net = require('net.box')

c = net:new(os.getenv("LISTEN"))

box.schema.func.create('tuple_bench', {language = "C"})
box.schema.user.grant('guest', 'execute', 'function', 'tuple_bench')
space = box.schema.space.create('tester')
key_parts = {1, 'unsigned', 2, 'string'}
_ = space:create_index('primary', {type = 'TREE', parts =  key_parts})
box.schema.user.grant('guest', 'read,write', 'space', 'tester')

box.space.tester:insert({1, "abc", 100})
box.space.tester:insert({2, "bcd", 200})
box.space.tester:insert({3, "ccd", 200})

prof = require('gperftools.cpu')
prof.start('tuple.prof')

key_types = {}
for i = 1, #key_parts, 2 do table.insert(key_types, key_parts[i + 1]) end  

c:call('tuple_bench', key_types)

prof.flush()
prof.stop()

box.schema.func.drop("tuple_bench")

box.space.tester:drop()