|
Bloom::Filter - Sample Perl Bloom filter implementation |
Bloom::Filter - Sample Perl Bloom filter implementation
=head1 DESCRIPTION
A Bloom filter is a probabilistic algorithm for doing existence tests in less memory than a full list of keys would require. The tradeoff to using Bloom filters is a certain configurable risk of false positives. This module implements a simple Bloom filter with configurable capacity and false positive rate. Bloom filters were first described in a 1970 paper by Burton Bloom, see http://portal.acm.org/citation.cfm.
use Bloom::Filter
my $bf = Bloom::Filter->new( capacity => 10, error_rate => .001 );
$bf->add( @keys );
while ( <> ) {
chomp;
print "Found $_\n" if $bf->check( $_ );
}
error_rate, capacity.
undef and complain
if the number of keys in the filter exceeds the configured capacity.
Maciej Ceglowski <maciej@ceglowski.com>
Feb 2007 big speedup by Dmitriy Ryaboy <dmitriy.ryaboy@ask.com> (thanks!)
(c) 2004 Maciej Ceglowski
This is free software, distributed under version 2 of the GNU Public License (GPL).
|
Bloom::Filter - Sample Perl Bloom filter implementation |