metrics icon indicating copy to clipboard operation
metrics copied to clipboard

POC fast historgam

Open yngvar-antonsson opened this issue 2 years ago • 1 comments
trafficstars

POC for #461

I moved the code from gist to histogram.lua and kept the old histogram in histogram_old.lua. I keep getting the same result for both histograms on my Intel MacBook. Maybe I did smth wrong?

ho = require('metrics.collectors.histogram_old')
api_timings_hist = ho:new('old')
hf = require('metrics.collectors.histogram')
api_timings_fast = hf:new('new')
clock = require('clock')
tarantool> clock.bench(function() local lbls = {method='api.users.get',ok='true'} local prev = clock.time() for _ = 1, 1e6 do api_timings_hist:observe(clock.time()-prev, lbls) prev = clock.time() end end)
---
- - 34.845349
...

tarantool> clock.bench(function() local lbls = {method='api.users.get',ok='true'} local prev = clock.time() for _ = 1, 1e6 do api_timings_fast:observe(clock.time()-prev, lbls) prev = clock.time() end end)
---
- - 34.938217
...

yngvar-antonsson avatar Sep 13 '23 10:09 yngvar-antonsson

This pull request is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days

github-actions[bot] avatar Nov 12 '23 18:11 github-actions[bot]