Re: [PHP] could use some suggestions to speed this short piece of code up

2010-01-20 Thread tedd
At 12:42 PM +0100 1/20/10, Rene Veerman wrote: Hi, for http://mediabeez.ws/htmlMicroscope/ (lgpl) i need to make large complex but _randomly filled_ test-arrays. Sometimes it's good to look at some of php's built in functions, like shuffle() and array_rand(). Cheers, tedd -- ---

Re: [PHP] could use some suggestions to speed this short piece of code up

2010-01-20 Thread Rene Veerman
this is at least 1000% faster the crux is that array()+=array() is way faster than any array_merge() operations. global $hmGenKeys; $hmGenKeys = 0; function htmlMicroscope_generateRandomArray ($maxKeys, $maxDepth, $maxDuration=-1) { global $hmGenKeys; if ($maxKeys!==null) { $hmGenKeys =