note 8976 deleted from function.str-repeat by jimw

From: Date: Wed, 02 Jan 2002 11:51:54 +0000
Subject: note 8976 deleted from function.str-repeat by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-24238@lists.php.net to get a copy of this message
For those of you who are using a for loop equivelent (in PHP3, I had done this), there are signifigant speed increases with larger repetitions. Here are the results of some benchmarking: 1000 replications of a space " " method: time in seconds for loop: 0.01015305519104 str_repeat: 0.00054299831390381 difference: 0.0096100568771362 1000000 replications of a space " " method: time in seconds for loop: 8.0847918987274 str_repeat: 0.1487090587616 difference: 7.9360828399658 The difference is hardly noticable for smaller numbers, but grows exponentially greater when the number of repititons grow. Just goes to show the advantage of compiled code :)

« previous php.notes (#24238) next »