Re:Redis new data structure: the HyperLogLog
by eurleif on Tuesday April 01, 2014 @06:15AM
(#7507155)
Couldn't HyperLogLog be implemented efficiently using Lua scripting?
[ Parent
| on HN ]
Yes it's possible. I did this a few years ago as a learning project, and the relevant lua scripts can be seen here: https://gist.github.com/dbro/9920666.
... but I wouldn't claim that it's done efficiently. From the comments in the code's tests:
# some results based on running speed tests on a lightweight netbook:
# standard error = 0.01, 10kb of registers
# < 1 ms per init()
# < 1 ms per update()
# < 1 ms per count() for single set
# ~30 ms per set for count() of union of sets
Re:Redis new data structure: the HyperLogLog
by lifthrasiir on Tuesday April 01, 2014 @06:30AM
(#7507181)
I haven't tried (so have a grain of salt), but I guess it would be certainly slower than the native implementation for various reasons. One reason that Lua does not support an efficient integer type yet (AFAIK 5.3 will support it though) comes to mind.