note 95541 deleted from gmp.examples by danbrown
| From: | danbrown@php.net | Date: | Fri, 08 Jan 2010 02:30:26 +0000 |
| Subject: | note 95541 deleted from gmp.examples by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164771@lists.php.net to get a copy of this message | ||
Note Submitter: Nitrogen
----
The comment below is correct..
Also, for this factorial business.. I believe it's pretty much the fastest way to making
factorials.
Here's some benchmarkings with the provided example code..
1M! in about 40 minutes.
5M! in about 15 hours, 30 minutes.
10M! in about 2 days, 7 hours.
Note: (n)M! = n millionth factorial.. computed on a 2.5GHz x64 processor.
And unfortunately, the GMP functions aren't multithreaded.
Here's some speed comparisons for making factorials:
gmp_fact():
0.01114893 secs
fact() manpage example code (in document above):
0.08637404 secs
BC Math bcmul():
7.85198307 secs
gmp_fact will be the fastest way to produce nice lengthy factorials.. it produced 100,000! in
exactly 10 seconds.. but obviously as the numbers get bigger, the slower it'll become.
I hope this information provides nice insight to these functions.