Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jeff Moore's Blog:
More Single vs. Double Qouting
Mar 09, 2005 @ 14:28:11

Jeff Moore has a new posting over on his blog today with more information in the Microbenchmarks of single and double qouting debate (as influenced by this post on Dynamically Typed).

I wrote earlier about flawed microbenchmarks. [...] First, PHP uses flex to tokenize the php source code. Flex is a table driven lexer. It doesn't necessarily follow that having more characters with special meaning makes flex slower if you don't actually use those characters.

Second, the original benchmark doesn't actually measure parsing time. Like all microtime() based benchmarks, the first access of microtime() doesn't happen until the php file is completely parsed and converted into opcodes. Additionally, it executed each literal inside a 10,000 iteration loop. Thats 1 time to parse it and 10,000 times to execute it.

He continues, giving a few code examples to back up some of the other stats mentioned, including the not-so-surprising fact that there really isn't that much of a difference between the two...

tagged:

Link:


Trending Topics: