MENU

Fun & Interesting

Bloom Filters

mCoding 56,957 1 year ago
Video Not Working? Fix It Now

Thanks to Hostinger: https://hostinger.com/mcoding Use coupon code MCODING at checkout to get an additional 10% off! Bloom filters are a simple probabilistic kind of set that exemplify how using probability to your advantage can result in huge performance wins at scale. By giving up some of the flexibility of a full set interface and even getting the wrong answer to "is this element in the set?" on a small percentage of elements, we can reduce memory usage in our example web service from over 1 GB down to 10 MB to keep a "set" of 10M links, which in turn makes it practical to store the data on-server instead of calling out to an (imaginary) costly third party API, allowing us to respond to clients immediately 98% of the time, resulting in much faster response times and a lower API bill. ― mCoding with James Murphy (https://mcoding.io) Source code: https://github.com/mCodingLLC/VideosSampleCode Bloom filters: https://en.wikipedia.org/wiki/Bloom_filter Confused about new Python 3.12 syntax? https://youtu.be/8l4UWz48Elc Made with Manim: https://docs.manim.community/ Sponsored by Hostinger: https://hostinger.com/mcoding SUPPORT ME ⭐ --------------------------------------------------- Sign up on Patreon to get your donor role and early access to videos! https://patreon.com/mCoding Feeling generous but don't have a Patreon? Donate via PayPal! (No sign up needed.) https://www.paypal.com/donate/?hosted_button_id=VJY5SLZ8BJHEE Want to donate crypto? Check out the rest of my supported donations on my website! https://mcoding.io/donate Top patrons and donors: Jameson, Laura M, Dragos C, Vahnekie, Neel R, Matt R, Johan A, Casey G, Mark M, Mutual Information, Pi BE ACTIVE IN MY COMMUNITY 😄 --------------------------------------------------- Discord: https://discord.gg/Ye9yJtZQuN Github: https://github.com/mCodingLLC/ Reddit: https://www.reddit.com/r/mCoding/ Facebook: https://www.facebook.com/james.mcoding CHAPTERS --------------------------------------------------- 0:00 Intro 0:54 Sponsored message 1:50 Bloom filter interface 2:21 Why bloom filters? 3:10 How does it work? 4:31 Analyzing the False Positve Rate 6:33 Where to get k hashes? 7:30 Bloom filter implementation 8:44 Bit Arrays 9:32 Running the example code 11:11 Thanks

Comment