Re:How we store 400M phone numbers with fast lookup
by d_e_solomon on Sunday July 19, 2015 @06:02PM
(#9912989)
Thanks for posting this article. Would this be a good use case for a bloom filter?
[ Parent
| on HN ]
Re:How we store 400M phone numbers with fast lookup
by fleitz on Sunday July 19, 2015 @06:15PM
(#9913028)
Maybe, probably not thought as a completely naive solution to this problem an array of 400M elements which is sorted, only takes 2.4 GB of RAM, or about $50 worth of RAM.
Basically you'd waste more time (and money) than it could possibly be worth.
Re:How we store 400M phone numbers with fast lookup
by mamp on Sunday July 19, 2015 @07:18PM
(#9913242)
You could get away with much less memory using Redis hashes with a few more lines of code: http://redis.io/topics/memory-optimization.
Re:How we store 400M phone numbers with fast lookup
by bpicolo on Sunday July 19, 2015 @06:37PM
(#9913121)
I mean, a bloom filter isn't super difficult, but it's also probabilistic instead of deterministic.
Re:How we store 400M phone numbers with fast lookup
by fleitz on Sunday July 19, 2015 @06:57PM
(#9913186)
Exactly, so you'd need the array anyway...
Also, typically bloom filters don't come out of the box with the language you're using, so it's just more potential for bugs.
A lookup on a sorted array should take 8.6 comparisons anyway, I bet the hashing takes longer...
Re:How we store 400M phone numbers with fast lookup
by d_e_solomon on Sunday July 19, 2015 @06:45PM
(#9913149)
That's true, good call.