
Originally Posted by
Snortles
P4 2.0 Ghz, 1 GB RAM, Apache 2, PHP 4.3.11, MySQL 4.1.12.
I ran that four times with an empty database.
Each time it took 120 to 129 seconds. Each time the first 4096 iterations produced a useable ID, after 4096 every single iteration produced a duplicate.
Here are my results, on a Celeron 2.0Ghz, 512MB RAM, Win2K3/IIS6 on a FAT partition, IBM 7200RPM HDD, PHP4.3.10(installed as an ISAPI), MySQL 4.1.8
I ran it on an empty table.
With the rand() function
Code:
Try - 1
~~~~~~~~~~~~~~~~~~~~~~~
Duplicate entry on 4097th iteration
Execution Time: 13.031807 seconds
----------------------------------------------------
Try - 2
~~~~~~~~~~~~~~~~~~~~~~~
Duplicate entry on 4097th iteration
Execution Time: 14.747309 seconds
----------------------------------------------------
Try - 3
~~~~~~~~~~~~~~~~~~~~~~~
Duplicate entry on 4097th iteration
Execution Time: 13.131423 seconds
----------------------------------------------------
Try - 4
~~~~~~~~~~~~~~~~~~~~~~~
Duplicate entry on 4097th iteration
Execution Time: 12.117329 seconds
----------------------------------------------------
Try - 5
~~~~~~~~~~~~~~~~~~~~~~~
Duplicate entry on 4097th iteration
Execution Time: 13.318612 seconds
now with the mt_rand() function
Code:
Try - 1
~~~~~~~~~~~~~~~~~~~~~~~
Duplicate entry on 29249th iteration
Execution Time: 89.172112 seconds
----------------------------------------------------
Try - 2
~~~~~~~~~~~~~~~~~~~~~~~
Timed Out on 37742th iteration
Execution Time: above 120 seconds
----------------------------------------------------
Try - 3
~~~~~~~~~~~~~~~~~~~~~~~
Timed Out on 39253th iteration
Execution Time: above 120 seconds
----------------------------------------------------
Try - 4
~~~~~~~~~~~~~~~~~~~~~~~
Duplicate entry on 37430th iteration
Execution Time: 114.875336 seconds
----------------------------------------------------
Try - 5
~~~~~~~~~~~~~~~~~~~~~~~
Timed Out on 38878th iteration
Execution Time: above 120 seconds

Originally Posted by
Snortles
Interesting.
Indeed!!
Bookmarks