Re: Re: optimilize web page loading
| From: | tedd | Date: | Fri, 28 Mar 2008 15:33:09 +0000 |
| Subject: | Re: Re: optimilize web page loading | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-272233@lists.php.net to get a copy of this message | ||
At 10:59 AM -0400 3/28/08, Robert Cummings wrote:
Nope, when processing a single quoted string there should be 4 available parse branches:As always, thanks for your most excellent explanation. I figured that something along those lines was happening. I didn't consider the escape concerns. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.comEOF ' (end of string) \ EOF \ ' anything else anything elseWhereas with a double quoted string you have something along the lines of:EOF " (end of string) $ (begin variable) { (possible begin interpolation) $ (begin interpolation) \ EOF \ ' " t n r x v f <digit> anything else anything elseSo presuming no variable is embeded and assuming no escaped characters... double quotes still need to check for the beginning of variable interpolation which has 2 different start possibilities. With respect to creating the byte code single quotes have 4 branches, double quotes have 6 branches in the simplest of cases with no escape and no interpolation. So one would expect compile time for double quotes to be approximately 33% slower than for single quotes. Once compiled though, the point is moot especially since most sites use a bytecode cache like eAccelerator or APC. Even without a cache htough, the time difference is teeeeeeeency, and this is just for informational purposes :) There are usually bigger eggs to fry when optimizing. One last thing though... even if this were escaped and even if there were fifty variables embedded, a good bytecode optimizer (not quite the same as a bytecode cacher) would optimize the bytecode for caching so that the string is broken up according to what needs to be interpolated and what does not.