OT: PHP BCMath slowness

meepbear * meepbear at hotmail.com
Thu Aug 4 11:17:46 PDT 2005

>I'm working on OpenID producer and consumer support for a PHP-based  
>content management system, and I am finding that BCMath seems to be  
>extraordinarily slow for such things as Diffie-Hellman  calculations...what 
>takes BCMath 40-45 seconds is done by GMP in just  a few seconds at most.  
>I am not sure if it is even wise to include  BCMath support if it is going 
>to over-run PHP's 30-second execution  limit in most cases.

What kind of hardware are you testing on? If I remember my own benchmarking 
correctly BCMath took about 18 odd seconds on a Celeron 500Mhz which is 
probably more or less what it will take on a modern server that's also 
performing other tasks at the same time.
It's also the reason why I only fallback to BCMath if both GMP and BigInt 
aren't present and most custom consumers/server wouldn't be used enough to 
get anyone into trouble with their host for excessive CPU usage.

Connection time-outs are likely to over-run the execution limit as well BTW. 
Livejournal seems to delay serving (non paid?) user blogs up to 10-15 
seconds at certain times of the day after the initial request.

More information about the yadis mailing list