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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
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})
---
- [1, 'abc', 100]
...
box.space.tester:insert({2, "bcd", 200})
---
- [2, 'bcd', 200]
...
box.space.tester:insert({3, "ccd", 200})
---
- [3, 'ccd', 200]
...
prof = require('gperftools.cpu')
---
...
prof.start('tuple.prof')
---
- true
...
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()
---
...
|