HyperLogLog — Count once, Count fast

HyperLogLog — Count once, Count fast

5 years ago
Anonymous $9jpehmcKty

https://medium.com/@animeshgaitonde/hyperloglog-count-once-count-fast-48727765ffc9

How do you find unique users ?Medium StatsBackgroundA couple of days back, I wrote my first post on Medium. I liked the novel feature of Medium ‘Stats’ which displays the number of views, reads, and also it’s graphical representation. One of the thoughts which struck my mind was whether I could increase my views by just clicking F5 button. I was being naive at first and knew Medium would have already solved this problem. As I contemplated, I could see more use cases with other websites, for instance Youtube displaying number of unique viewers, Google Analytics showing unique searches for a given month, an E-commerce website presenting number of visitors, and many more. This awakened the programmer inside me and I could come up with the below solution to find number of unique visitors of any site.

At the top of my find, to count the number of unique entries the most efficient data structure would be a Set and it’s size would provide the unique count of entries. The following code snippet would keep track of and give count of unique visitors

Last Seen
38 minutes ago
Reputation
0
Spam
0.000
Last Seen
12 minutes ago
Reputation
0
Spam
0.000
Last Seen
about an hour ago
Reputation
0
Spam
0.000
Last Seen
29 minutes ago
Reputation
0
Spam
0.000
Last Seen
about an hour ago
Reputation
0
Spam
0.000
Last Seen
8 hours ago
Reputation
0
Spam
0.000
Last Seen
27 minutes ago
Reputation
0
Spam
0.000
Last Seen
29 minutes ago
Reputation
0
Spam
0.000
Last Seen
39 minutes ago
Reputation
0
Spam
0.000
Last Seen
58 minutes ago
Reputation
0
Spam
0.000