HipHop VM: now at 98.5% PHP framework parity, 16% faster
hhvm.com
hhvm.com
Is the 15% performance increase relative to vanilla PHP or to a previous version of HHVM?
The 15% increase is relative to HHVM at the beginning of the 3-week sprint they just completed. HHVM was already far faster than vanilla PHP when it was first publicly announced over a year ago.
1. For simple code only - once it's more computationally intensive, HHVM wins. http://www.alexfu.it/2013/10/22/symfony-benchmark-on-hhvm.ht...
2. http://blog.liip.ch/archive/2013/10/29/hhvm-and-symfony2.htm...
I'm pretty happy with it. Is it worth it? Well, if you've got a test suite, run it through HHVM to see if you'll have any issues. If the answer is no, then why turn down free performance :)
I use Nginx as frontend and direct all dynamic request to HHVM's own webserver (https://github.com/facebook/hhvm/wiki/Using-nginx-as-Front-S... )
Keep in mind, Facebook runs on HHVM too, so it's rock solid.
Btw. the devs are very helpful on the official irc channel!
HipHop took PHP code and basically turned it into a statically compiled C++ application. The resulting binary acted directly as a web server. It was pretty fast, but very limited.
HHVM is an actual JITing virtual machine for PHP. It's still huge (one of the project pages say that the binaries are nearly a hundred megs), but it's now a real-world reimplementation of PHP, capable of doing anything PHP can, including eventually being run by mere mortals with normal code.
Now if only the rest of the PHP devs stuck in 2005 would switch to it...
Me, I'm not really keen on the Component::function() syntax. Feels like a crutch to me. Especially when people go out of their way to avoid specifying namespaces by abusing class_alias. Plus you're not really saving that many keystrokes compared to, say, $this->app['component']->function(). (Yes, I like Silex).
OTOH, I had a much easier time with Laravel, though it uses some of the same Symfony components under the hood.
Laravel has a half decent API and doesn't rely overmuch on (untestable) static functions. My evaluation of FuelPHP was admittedly brief, but let's take another look:
http://fuelphp.com/docs/general/controllers/base.html
and http://fuelphp.com/docs/general/models.html
For those who may be unaware, the issue with static functions is that, if you are calling a static method, you will execute that method. You're not able to choose not to execute that method (unless you do something surpassingly stupid like checking whether you're in test mode), and you can't generally make that method return anything other than what it normally does. Isolating that static method is rather difficult, and if that static method happens to call another one, well, it had better not be an issue with your test, because you're not going to stop it happening.
I know the FuelPHP devs have gone on record saying that Fuel doesn't rely heavily on static methods, and that static methods aren't a problem, and that to the degree to which there is a problem, they are gonna fix it, but...
Here we compare CakePHP, Laravel, and FuelPHP (Thank you to Sebastian Bergmann for providing the statistics utility). For anyone actually evaluating these platforms, you may want to check out these benchmarks as well:
http://www.techempower.com/benchmarks
Without saying anything about how easy or fast it would be to develop for each of them, it seems that for trivial tasks Laravel > Fuel > Cake. From the code statistics, we have: Fuel: 785 static methods (22.45%) Cake: 530 static methods (7.96%) Yii: 483 static methods (7.95%) Laravel: 0 (0.00%)
Laravel seems pretty light as far as that goes, and generally when I'm faced with a large project I want the framework to be large as well. I feel like otherwise I'm going to end up finding or writing libraries for things that I feel like the framework should take care of. I would have a hard time recommending a PHP framework, imo they're all pretty much crap. Laravel is not better per se than other frameworks, but it does (far) less, and therefore does it less badly. Divine intervention alone will fix the PHP world at this point, but if you can avoid CodeIgniter, Yii, and FuelPHP, probably no other choices will be as bad.
The really cool part though, it truly was "drop in". Every bit of my existing nginx/fpm configs worked as is, so once it's a bit further along, it's just a matter of shutting down fpm and firing up HHVM.
There were also a couple of gotchas in the setup related to the fact that their apt installer installed HHVM configs that don't assume Fastcgi, so it took a little bit to figure out the correct edits to the init script and HHVM config so it'd listen on :9000 instead of :80, but all in all that it worked at all was really fun for a minute. Very excited about this project.
compare:
php 5.5: https://travis-ci.org/laravel/framework/jobs/15683979
First read the page related to your Linux/BSD e.g. "Prebuilt Packages on Ubuntu 12.04"
Then read the page "Using nginx as Front Server to HipHop"
As last step read this blog article how to write/edit the config file (/etc/hhvm.hdf): http://www.hhvm.com/blog/113/getting-wordpress-running-on-hh...
Read this and copy things you need from the documentation: https://github.com/facebook/hhvm/blob/master/hphp/doc/option...
This is how I got HHVM working.
To sum up:
* you need a little bit of basic Linux knowledge
* install Linux or BSD (e.g. Ubuntu 12.04 LTS) (64-bit)
* install Nginx (or since last week HHVM also supports Apache with FastCGI)
* install HHVM
* install MySQL or MariaDB, etc.
* create a web directory where you place your php files
* edit the hhvm.hdf (config file)
* start hhvm
Btw. a lot of blog posts you find with Google search are still about the old HpHp (the former and now outdated PHP to C++ translator also called HipHop from FB)... so better skip third party blog posts older than January 2013 ;)Fortunately, by the Pentium era, which was when PHP was designed, those times were long gone.
"X made this design decision before us" is never a good justification for any design decision unless the decision is truly arbitrary (i.e., are arrays 0 or 1 indexed?) -- then it might be better to stick to what's more familiar. If it was a good design decision then, then there must have been some reason at the time that should be true now to give a good case for repeating a design decision.
read this:
http://philsturgeon.co.uk/blog/2013/09/t-paamayim-nekudotayi...
E.g. XMLHttpRequest vs ExtensibleMarkupLanguageHypertextTransferProtocolRequest
and ftp_ssl_connect vs FileTransferProtocol_SecureSocketLayer_Connect
or if you want to get really ridiculous:
MysqlndUhConnection::sslSet becomes MyStructuredQueryLanguageNativeDriverUserHandlerConnection::SecureSocketLayerSet
Not being very familiar with PHP, I don't have any pet examples of inconsistent names to offer corrections for that might correspond with what he's actually talking about.
Basically, if you use PHP you're part of the largest computer joke in history.
I have no problem with using either PHP or Python on a particular project, depending on what is involved. I wish PHP threads would show a bit more maturity/pragmatism on both sides of the aisle sometimes.
http://yougov.github.io/pycon/slides/
http://highscalability.com/blog/2012/3/26/7-years-of-youtube...
http://www.slideshare.net/jinaljhaveri/scaling-python-webapp...
http://blog.disqus.com/post/62187806135/scaling-django-to-8-...
The problem is speed and compatibility. If you did it natively you'd have to do it twice, once for HHVM and once for the Zend engine. If you did it in pure PHP it would cause performance issues since the interpreter isn't smart enough to inline (maybe HHVM is, but even it will take a trace or two to realize the JIT need probably).
e.g.
function findFirst ($haystack, $needle, $before_needle=false, case_sensitive=false) {
if (case_sensitive) {
return stristr($haystack, $needle, $before_needle);
}
return strstr($haystack, $needle, $before_needle);
}
You can submit them as RFC to https://wiki.php.net/rfc and maybe your suggestion end up in a future version of PHP. As PHP code in HHVM is almost as fast as C++ code, your wrapper functions will be still useful for you in the meantime. $foo = 'bar';
echo $foo->length(); // 3
echo strlen($foo); // 3
This would get rid of a lot of the confusion around string function names.I was thinking of recording the production requests for x amount of time and replaying them on HHVM so you could see if responses are identical, there are no crashes, state of the database is same afterwards, etc.?
Seriously though, I decided that if I had a project that was difficult to test, that I knew had hairy code that used some funky features it was best to just stick to APC. All my new projects are being built on HHVM directly with test suites as I go.
Edit; that was a while back now, though. What frameworks and libraries are you using? Run their test suites through HHVM and if they all pass, you'll be fine. Facebook use it themselves now apparently.
Another idea once you're reasonably comfortable and have done a smoke test is to direct a small amount of your traffic/users (say 1%) to the HHVM version, while closely monitoring its error log.
There generally aren't a lot of status meetings, team meetings, project meetings, and so forth at Facebook, but you might want to turn down a request to present at another team's meeting, or turn down those requests to interview - they can wait, or another person can be found.
People tend to make progress on lower-priority work items in between higher-priority work items - things like migrating onto a new library or version of a service, or maybe migrating from one set of machines to another if you aren't using one of the high-level service management systems. This is necessary to prevent these things from becoming interrupt items down the line, but during a lockdown period, it's okay to let these slide for a bit.
If the whole team does this, then suddenly you're spending a lot more time together. Instead of potentially working on different parts of the software like you usually do, you can all focus on a particular class of problem - in this case, performance and parity. That means everyone has that context loaded up, and you can have better discussions and quicker code reviews.
https://github.com/facebook/hhvm/blob/master/hphp/test/frame...
See: http://wordpress.org/plugins/facebook/
;)
Then again, it's not impossible to learn a new environment or career path... and I'm quite against the thought that any language could permanently ruin a coder.
Additionally, something being popular implying it's good is a blatant fallacy.
Symbian / Nokia went the way of the dodo because the end user fell in love with the ease of use of the iPhone.
In our case, the end users are people who use the internet, not the ones writing code.
Your argument is about as ridiculous as I can imagine, with no real data to back it up other than your frothing hatred of a language.
Also, the end users of a programming language are the programmers, not the users of the application. 99% of users could not care less what's under the hood just as long as it works.
I don't hate PHP, but I've written, looked at, and audited enough of it to come to dislike it.