NYCPHP Meetup

NYPHP.org

[nycphp-talk] new hash filter system..

Joel De Gan joel at tagword.com
Tue Apr 27 14:45:20 EDT 2004


On Tue, 2004-04-27 at 13:05, Adam Maccabee Trachtenberg wrote:
> Why don't you use GMP?
> 
> http://www.php/net/gmp
> 
> It requires an external library, but it'll be much faster than an
> all-PHP solution for very large numbers.
> 
> There's also the BC math library, which is bundled with PHP, but you
> need to emulate bitwise operations in userland code, which doesn't
> seem too efficient.

One of my original ideas for this used BC and multiplied primes (four
digit up to six digit primes, a few thousand of them total) once for
each insertion. Obviously the number got large, but the solution worked
when using modulus because the end result would always mod to zero if
the prime was used in a bcmul() at any point on that number (primes used
to not have false positives). I chose to throw away that implementation
due to the filter size required to handle numbers that are over a
thousand digits for each portion of the filter. I also found the limits
for function base_convert() for base36
(http://us4.php.net/manual/en/function.base-convert.php)

I may use that type of filter at a later date for something else, but I
chose the alpha system for simplicity and smaller filters.

-Joel De Gan

-- 
joeldg - developer, Intercosmos media group.
http://lucifer.intercosmos.net




More information about the talk mailing list