14 ms·
Refactored PHP engine makes Wordpress 20% faster
- trebor 12y agoGood news, any idea which version this will be included in? I know PHP 5.6 is already in beta, so I'd assume this'll be PHP 5.7, but this is really good news. We have some sites that are just begging for an actual 10-30% increase in speed.
- mrsaint 12y agoIt's PHP 5.7.0-dev right now. You can download and compile the development branch yourself: https://wiki.php.net/phpng https://wiki.php.net/phpng
- kolev 12y agoGreat. Any ETA on phpng stable release?
- trebor 12y agoGive it a year or two. Seriously! 5.5 was just released a little while ago and 5.6 is just in beta now.
- kolev 12y agoJust try to imagine HHVM in year or two. Zend PHP will be irrelevant by then.
- velodrome 12y agoThe only way that is going to happen is if HHVM was integrated into PHP core (similar to ZendOpcache).
- enterx 12y agoHHVM is a reimplementation of the PHP language. http://grokbase.com/t/php/php-internals/12bvegp9cv/hhvm-and-php http://grokbase.com/t/php/php-internals/12bvegp9cv/hhvm-and-...
- trebor 12y agoIrrelevant how? I doubt BlueHost, HostGator, Dreamhost, etc, and on and on will have implemented HHVM as their core PHP offering by then. Most web hosts still have PHP 5.3 installed, and even the PHP 5.4 I've used on Media Temple's servers is out of date. But at the rate PHP's release cycle has accelerated (remember that 5.3 dates from 2009...) it's entirely likely that the trend will continue. And more hosts are offering up-to-date PHP versions as an option. I still see a future for Zend PHP.
- kolev 12y agoIn 2 years, HHVM will perform so much faster than PHP 6 and Hack will offer so many added benefits that even the shared hosting guys will switch to it as it will make them serve more sites with the same hardware plus developers will push to have Hack in place anyway.
- coldtea 12y agoThat's not how it normally works with those kinds of re-implementations. Heck, Python 3 hasn't even replaced Python 2 -- and people will dump PHP for Hack? A language which doesn't even have a community at the moment, it's 99% Facebook people.
- kolev 12y agoPython 3 is a different story! As you mention below outliers, let's not use them, please! GNU/Linux OS does not depend on PHP like it depends on Python.
- kolev 12y agoAlso, if we have to use Python as an example, then PyPy was a better analogy than Python 3.
- coldtea 12y agoOnly I compared PHP to Hack above. PyPy would be a better analogy to HHVM-PHP.
- kolev 12y agoI'm not sure why you guys ganged up to downvote on something obvious - PHP is loosing grounds to HHVM already. I'm considering it for all my PHP projects already - it's easy to install and most PHP frameworks are well-supported already (http://hhvm.com/frameworks/ http://hhvm.com/frameworks/). I can imagine HHVM having integration within Nginx a la HttpLuaModule, which uses LuaJIT and would eliminate going the FastCGI route.
- coldtea 12y ago>I'm not sure why you guys ganged up to downvote on something obvious - PHP is loosing grounds to HHVM already. Perhaps because some on HN are computer scientists, so to convince them it takes actual numbers and not some anecdotal evidence of what you personally use. Judging from all available data sources, you are an outlier. HHVM doesn't have that large a community (mostly FB people), is not installed in the overwhelming majority of hosts, still has compatibility issues, has few posts about it, there are very few mentions of companies using it, and, for what it is, has been largerly ignored in the whole PHP community (forums, etc).
- kolev 12y agoI have nearly 30 years of professional experience and my intuition is pretty reliable. If HHVM wasn't what runs the largest PHP app in the world, things would have been much different. Hack brings many language people that Zend for one reason or another didn't not deliver all these years.
- smsm42 12y agoBlue whale is the largest mammal on the planet, but that doesn't mean eating nothing but krill is a good idea for every mammal. Everybody has different needs and different capabilities, so "Facebook does it" and "everybody does it" are quite different.
- kolev 12y agoAs a side note, krill is pretty nutritious - just not widely available to all mammals.
- debacle 12y agoFor what it's worth, I agree with you. Don't know why the downvotes are coming - it's very clear to see that FB is going to be better for PHP than Zend.
- LawnGnome 12y agoI suspect this'll be the basis of a new major version, based on early discussions. It probably won't be a 5.x release.
- frik 12y agoThere are already PHP 6 books out there from 2009 (planned v6 renamed to 5.3): https://www.google.com/search?q=php+6&tbm=bks https://www.google.com/search?q=php+6&tbm=bks They could name it PHP 7 to avoid further confusion.
- velodrome 12y agoPHP 6 was really about unicode support. It will actually create even confusion among veterans. Also, those PHP 6 books are really aimed at beginners. In addition, skipping a version number also creates confusion. If they were going to go this route, they should have done it a long time ago (around 2010-2011). http://www.slideshare.net/andreizm/the-good-the-bad-and-the-ugly-what-happened-to-unicode-and-php-6 http://www.slideshare.net/andreizm/the-good-the-bad-and-the-...
- nly 12y agoYeah well... give it just a couple of more years and there will be kids born as Perl 6 was announced getting webdev jobs.
- BorisMelnik 12y agoWith claims / benchmarks like this I am sure you are right, particularly for a product that ships as much as WordPress does. Wordpress 3.6 – 20.0% gain (253 vs 211 req/sec) I have a few enterprise sites that I am constantly looking for ways to optimize for speed: DNS, CDNs etc. This looks like an easy win.
- ErrantX 12y agoLooks like it will be 5.7 which is great! Just tested against our codebase, and it builds very quickly (maybe 15-20% increase in speed in unit tests) so very impressed!
- fastest963 12y agoCan't wait to play around with this once they support a few more extensions!
- neals 12y agoI love how, through all the hate and bandwagoning, some people don't get discouraged and actually do something to improve the product. We still do new projects in PHP and we couldn't be happier.
- adamors 12y ago> We still do new projects in PHP and we couldn't be happier. I concur, especially when frameworks like Symfony exist. Reading all this smack talk about PHP on HN is so alien considering how thriving the PHP community actually is.
- awestroke 12y agoNobody mentions how much or little the PHP community thrives. People point out how bad PHP compares against other languages. The fact that you enjoy using PHP and that you can create great products with it does not imply that it has no flaws. Many have been where you are now, and then moved on to other languages to never ever look back. From what I've seen, the reverse is much less common.
- deleted 12y ago[deleted]
- newaccountfool 12y agoIf you enjoy programming in it, and you can create great code then what's the problem?
- devNoise 12y agoThis sounds like a nice improvement to PHP performance. Are there any parts of the language that will have to change for this enhancement? I expect that that changes will be minimal, if any are needed.
- rossriley 12y agoFrom what I can see there shouldn't be any userland breaks unless it's very obscure. In the internals all of the zend_hash apis have been updated so it may have an effect on some extensions, though the core extensions can all be updated.
- devNoise 12y agoI think you're right. The line that made me think that something might change is: "we changed the basement trying to keep most of the building unchanged." The "most" part made me wonder what obscure part of userland it would be.
- frik 12y agoGreat news. HHVM and now PHP 5.7, both with JIT - the future of PHP looks bright.
- dparoski 12y agoTo my knowledge a JIT compiler is not being added to PHP 5.7. Can you clarify your comment or provide a link to the source where you heard this?
- captain_mars 12y agoI'm not the person you replied to, but I got the same impression. The linked email in turn links to the PHP NG page (https://wiki.php.net/phpng https://wiki.php.net/phpng) on which the version number mentioned is 5.7.0-dev
- smsm42 12y agoWhile it indeed is marked as 5.7-dev, which is because it is forked from master branch which is always marked next minor version from current release one (5.6), it is very likely that it would be next major version. The changes in this refactoring are extensive and deep, and more are probably to follow. Pretty much every extension will need to be ported. This is what major versions are for.
- nijiko 12y agoThe parser needs to be rewritten really.
- nodesocket 12y agoLove the work, but honestly by the time PHP 5.7 is ready for mainstream (with extension support mysqli, memcache, mongo), Facebook HHVM will be the defacto standard. FB has a huge head start and can throw nearly unlimited money and engineering hours at the problem. Seems like a losing battle, but perhaps I am wrong.
- batmansbelt 12y agoNo one ever says that the different python implementations are fighting a losing battle. People generally seem to say that having multiple implementations is good for the language.
- pjmlp 12y agoWhen there is only one, people tend to confuse implementation with language. Additionally there is also a way to sort out possible bugs in language specification, as differences across implementations are sorted out.
- NameNickHN 12y agoPHP's success is the result of PHP being available at even the tiniest webhost. I don't see that happen for FaceBook HHVM, though. FaceBook HHVM performance results will spur on Zend's efforts in making the PHP engine faster, though.
- jack9 12y ago> PHP's success is the result of PHP being available at even the tiniest webhost. I don't think so. PHP was the most performant (when paired with MySQL) and the simplest environment/language to develop with, for the time (late 90s onward). Projects grew and money was made off of functional sites that scaled to the critical mass. It was common to hire highly skilled developers for optimizing parts of a site that had been originally done in PHP. If PHP only interacted with Oracle or had been relatively slow as an Apache module, it would never have been popularized. Period. Java, C, Perl, LISP, etc were simply left behind with convoluted setups and ridiculously difficult syntax for the simplest of tasks (java was particularly immature). Later, webhosts appeared and PHP was trivial to integrate (as it had always been). In the late 90's the cheapest webhost was about $5 a month (thread.net - with a waiting list) By 2000, Yahoo had done a proper assessment and moved over straightforward development to PHP (still using oracle though). It's interesting to see so many languages fail to adopt the obvious characteristics that made/make PHP popular. PHP has started to stumble away from those same characteristics in the pursuit of specific agendas by framework developers and language contributors (PSRs are a myopic farce). Performance, ease of deployment....who else has this? Oh yeah, Javascript. Never mind how horrid that language is, it matched PHP for ubiquity (thx to apple and other vendors standardizing and implementing so <noscript> has gone away for the most part). HVVM is more performant (for any non-trivial code). Will this be enough to give it superior momentum? Probably...until PHP finally just adopts it. Java's VM sucked and you wanted to always be using JRockit VMs 4 years ago. Eventually Oracle simply integrated them together. I see that as the eventual end here.
- ohwp 12y agoRefactoring Wordpress will make it even faster. Look at the difference between Drupal and Wordpress. It's amazing Wordpress is still used for big sites while a ton of recourses could be saved. But great work on the PHP engine!
- nacs 12y agoAgreed. I ran a benchmark against CodeIgniter on a test box recently and was suprised that a single query app performance went from around ~20k req/s with raw PHP (no framework) to around ~3k req/s with CI and thought that was bad for a framework. I didn't realize Wordpress performance was so much worse especially given its popularity. Most Wordpress sites use a caching plugin like WP Super Cache or Varnish-type setup if they get decent traffic though.
- raverbashing 12y agoDepends on the WP plugins, I suppose (and Indexes created, and MySQL tuning, etc)
- mrsaint 12y agoAnd themes. It's not unusual to see themes that cause 100+ database queries. Per pageview.
- trebor 12y agoLots of these themes include 3 menus. And Wordpress menus are notoriously query heavy. That's why a lot of sites have caching—not because the page is large, but because the menus take so long to load.
- jafaku 12y agoCI is a badly designed and outdated framework. For real speed you should use something more professional like Symfony2.
- 12y ago
- woah 12y agoWhy does it matter? Visitors should never hit WP anyway if you are smart. Set up caching.
- andy_adams 12y agoIt makes a big difference if your site isn't just for displaying static HTML content - for example, a WordPress-powered community where users log in to your site.
- lucb1e 12y ago> Wordpress 3.6 – 20.0% gain (253 vs 211 req/sec) How do you generate 211 pages per second on Wordpress to begin with? My server does page generation for my own custom-built blog in ~15ms, but takes a whopping three seconds for a single Wordpress page. I know it's somewhat offtopic and it's about the relative results, but what hardware is this?
- muppetman 12y agoAre you running an opcache like Zend Opcache, APC, XCache etc? 3 seconds is amazingly slow.
- lucb1e 12y agoI meant raw page generation times. With caching it was much quicker of course. I assume the PHP benchmarks are also non-cached, else you're just benchmarking the caching method.
- muppetman 12y agoYea, opcache "caches" the compiled PHP code. So the first "page generation" might take ages, because PHP has to load all the .php files and compile them. But an opcache will _keep_ the compiled versions around, so the next time you need to execute the .php files, it can skip the (very expensive) step of compiling them again. This makes PHP much, much faster. The only time the files are recompiled are if you restart your webserver, or if you modify the .php files. I'm not talking about static html generation, that's another thing all together.
- deleted 12y ago[deleted]
- munimkazia 12y agoIt is good to hear that they even managed to refactor their code, even if you don't look at the performance benefits. Now, I hope that their next major upgrade will be a complete API overhaul, though it means making the existing thousands of themes and plugins incompatible.