Live data from Hacker News

PHP Team Responds to Google's PHP Tips

groups.google.com

1–10 of 40 posts

Re: PHP Team Responds to Google's PHP Tips

#2
I was waiting for that. The history of micro-optimization is replete with myths and legends which sound juuuuuuust plausible enough to be true (or were true a decade ago) and endure to this day.

I'm currently involved in a project at work which requires translating a (Java) coding standards document. I have filed probably two dozen bugs against the document that sound like "The rationale for standard 2.4.3 is translated correctly from the Japanese but contrary to technical fact." They include my personal favorite Java performance tip "Don't use the nice readable str + str syntax to concatenate, instead, use StringBuilder."

Re: PHP Team Responds to Google's PHP Tips

#3
post #2

I was waiting for that. The history of micro-optimization is replete with myths and legends which sound juuuuuuust plausible enough to be true (or were true a decade ago) and endure to this day. I'm currently involved in a project at work which requires translating a (Java) coding standards document. I have filed probably two dozen bugs against the document that sound like "The rationale for standard 2.4.3 is transla…

I don't know if it is really indicative of anything, but I remember micro-optimization being a rather prevalent topic during my PHP days. Perhaps it was just the folks I was reading, I don't know.

The only thing worse than an article about micro-optimization is one that is both out of date and almost entirely backwards.

Re: PHP Team Responds to Google's PHP Tips

#5
"When simple strings with no variables in them are used, the performance is clearly better with double-quoted strings due to implementation details in the engine."

Is there any way this could be true except that they went out of their way to slow down single-quoted strings? How could it possibly be slower to do fewer steps?

Re: PHP Team Responds to Google's PHP Tips

#6

"When simple strings with no variables in them are used, the performance is clearly better with double-quoted strings due to implementation details in the engine." Is there any way this could be true except that they went out of their way to slow down single-quoted strings? How could it possibly be slower to do fewer steps?

If I was going to guess, I'd say that double quoted strings are passed to a different "engine" than the single quotes, and perhaps over time the double quote engine has received better optimization.

Re: PHP Team Responds to Google's PHP Tips

#9
Despite google dropping ball on this one, some good may come from it having spurred Gwynne Raskind's reply: Anyone out there writing PHP might find real optimization value from Alex Songe comments, concluding with (following Gwynne's article):

Good resources (written by the guys who actually work on the php engine):

http://ilia.ws/files/phptek2007_performance.pdf 
 (13 MB)

http://ilia.ws/files/phpquebec_2009.pdf ( 1.1 MB )

edit: added file size

Re: PHP Team Responds to Google's PHP Tips

#10

"When simple strings with no variables in them are used, the performance is clearly better with double-quoted strings due to implementation details in the engine." Is there any way this could be true except that they went out of their way to slow down single-quoted strings? How could it possibly be slower to do fewer steps?

If I was going to guess, I'd say that double quoted strings are passed to a different "engine" than the single quotes, and perhaps over time the double quote engine has received better optimization.

Yeah, thats what I also figured but, really, how much can you optimize a constant string literal (which I'm given to understand the single-quote thing is)?

Must be some kind of caching optimization and not really something that saves CPU cycles

Post reply on HN