TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

PHP Team Responds to Google's PHP Tips

153 pointsby hailpixelalmost 16 years ago

14 comments

CalmQuietalmost 16 years ago
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):<p>Good resources (written by the guys who actually work on the php engine):<p><a href="http://ilia.ws/files/phptek2007_performance.pdf" rel="nofollow">http://ilia.ws/files/phptek2007_performance.pdf</a> 
 (13 MB)<p><a href="http://ilia.ws/files/phpquebec_2009.pdf" rel="nofollow">http://ilia.ws/files/phpquebec_2009.pdf</a> ( 1.1 MB )<p>edit: added file size
评论 #677019 未加载
patio11almost 16 years ago
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.<p>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."
评论 #676892 未加载
评论 #677209 未加载
dimarcoalmost 16 years ago
I (naively) read Google's performance tips as fact and wouldn't have thought twice about it. Lesson learned.
评论 #677031 未加载
niralmost 16 years ago
Even if all the tips were valid, the performance gain is tiny in comparison to simply installing an opcode cache (APC/Zend/etc).<p>And even after installing the opcode cache, performance for many web apps doesn't improve much as the bottleneck is often in the DB. Caching DB results where possible (pretty simple to implement with your own code or an external library) often results in far greater performance gain than any type of code optimization. If you can actually cache the resulting HTML (all or parts), even better.
评论 #677032 未加载
randallsquaredalmost 16 years ago
"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."<p>Is there any way this could be true <i>except</i> that they went out of their way to slow down single-quoted strings? How could it possibly be slower to do fewer steps?
评论 #676909 未加载
评论 #676944 未加载
评论 #677247 未加载
评论 #677037 未加载
Tagithalmost 16 years ago
It should probably be noted, however, that the original article's suggestion to "avoid doing SQL queries within a loop" is still a good one. Granted, this isn't PHP-specific, so perhaps this wasn't the right place for it. Furthermore, on small traffic websites (which, as other commenters mentioned, are probably the target of an article like this) likely wouldn't see a significant speed up, given the low query volume. Nevertheless, minimizing trips to the database is a good idea.
ckinnanalmost 16 years ago
APC opcode caching absolutely turbo-charges PHP. Quadruple performance.
评论 #677114 未加载
评论 #677683 未加载
mindaugasalmost 16 years ago
related and helpful - <a href="http://www.phpbench.com/" rel="nofollow">http://www.phpbench.com/</a>
评论 #677355 未加载
dxjonesalmost 16 years ago
Wow! What a stinging rebuke. ... and well-deserved, it seems.<p>Considering Google's influence and reputation, it's really important the PHP Team took the time and effort to respond to the "tips" and set the record straight.
bdmac97almost 16 years ago
Very nice response by the PHP team IMO. I fell out of love with PHP a looong time ago but harbor them no ill-will. Seeing how silly some (most?) of the suggestions Google gave was very disappointing.
MikeRB23almost 16 years ago
Truly disheartening. I've also trusted Google without thinking twice...lesson learned. Myself and others I'm sure are now going to take Google's "tips" with a grain of salt.
floohaalmost 16 years ago
Wow, that's funny. When I read it, I was thinking, "Can this (or that) really make a significant difference.?". Then I thought, "Well, it must since it's on Google's tips page.". Bzzzzzzzt. Wrong.<p>I feel sorry for all the people who instantly started hacking (as in machete) up their entire app based on this advice.
erlangeralmost 16 years ago
PHPwn.
pbhjpbhjalmost 16 years ago
pwned
评论 #680611 未加载