Closed olegrok closed 4 years ago
Hi! Thanks for the patch! Look good, but I am proposing to add some benchmarks with results.
The simplest variant. I use vynil as engine, because it allows to get more indicative results
local clock = require('clock')
local json = require('json')
local queue = require('queue')
box.cfg {
vinyl_memory = 100000,
log_level = 3,
vinyl_write_threads = 5,
}
local tube = queue.create_tube('bench', 'fifo', {engine = 'vinyl'})
local count = 1e5
local task = string.rep('x', 10)
for _ = 1, count do
tube:put({task})
end
for _ = 1, count / 2 do
tube:take()
end
print('Inserted:', count)
collectgarbage()
collectgarbage()
local start = clock.time()
local stats = queue.stats()
local result = clock.time() - start
print(result, json.encode(stats))
box.snapshot()
os.exit(0)
Before: 2.53s After: 2.13s
Hello. Thanks for the benchmark. It's look like the patch improves performance(~16%). And LGTM. But I think that calculating statistics during a work of the process looks better. This will allow to have relevant data at hand.
Hello. Thanks for the benchmark. It's look like the patch improves performance(~16%). And LGTM. But I think that calculating statistics during a work of the process looks better. This will allow to have relevant data at hand.
Yes, I agree, I think we could call current stats
implementation once at start then increment counter for every operations. But it should be done in separate patch.
As it was done here: https://github.com/moonlibs/xqueue/blob/master/xqueue.lua#L1326
I think the fix is okay. We can left the issue #92 open and implement a kind of materizlized view later.
Oleg, please, don't do this anymore. I had the plan to release all critical fixes in one release (it'll as stable as possible), but perf. improvements in another one.
Restricted master
branch.
Ok, sorry. I didn't know about your plan and understand your "approve" as "ready to push"
Need for #92