Associative Array Benchmarking

From: Date: Sun, 19 Sep 2004 01:33:09 +0000
Subject: Associative Array Benchmarking
Groups: php.general 
Request: Send a blank email to php-general+get-197152@lists.php.net to get a copy of this message
Although I'm not certain how well known this is, I thought I'd share this with everyone who might have wondered if there was a benefit to using or not using quotes when referencing associative arrays. While benchmarking a few different array sorting options, I had used in_array and search_array. I noticed that one was more than 30% faster than the other. On further investigation I realized I had used quotes one one and not the other. Benchmark results: Function assocArrayWithQuotes() ran 500000 times in 4.4331 seconds. Function assocArrayWithoutQuotes() ran 500000 times in 6.4170 seconds. The only difference in the two functions is the use of quotes, one with and the other without. Flame at will.

« previous php.general (#197152) next »