LLVM Code Generation in HHVM(hhvm.com) |
LLVM Code Generation in HHVM(hhvm.com) |
In the past LLVM has been almost completely unusable for dynamic languages. Not it seems there are dynamic two implementations using it (at least JavaScriptCore). So this is a pretty good result.
The other good result is that it shows with LLVM other architectures were supported than x86.
I know at least pypy and unladen swallow have tried to use it in the past (5+ years ago) with no success.
HHVM (aka the HipHop Virtual Machine) is an open-source virtual machine designed for executing programs written in Hack and PHP. HHVM uses a just-in-time compilation approach to achieve superior performance while maintaining the flexibility that PHP developers are accustomed to. To date, HHVM (and its predecessor HPHPc before it) has realized over a 9x increase in web request throughput and over a 5x reduction in memory consumption for Facebook compared with the PHP 5.2 engine + APC.
http://talks.php.net/singapore15#/drupalbench
php7 is sometimes faster than hhvm, and sometimes a bit slower, but both are generally faster to much faster than earlier versions.
(and 5.4 was faster than 5.2 which the GP referenced)
I'm actually giving a talk at OOPSLA this week about how we went about actually doing the conversion (everything from how we approached designing the system to how we convinced engineers to use it), if you or anyone reading this happenes to be going. http://2015.splashcon.org/event/splash2015-splash-i-josh-wat... I think it will also be recorded.
When you have a large existing codebase in one language, migrating it to a new language means a massive amount of time wasted retraining engineers, rewriting code, etc. You lose a lot of productivity and spend a lot of money for possibly little gain.
I was actually most interested to hear about HHIR and their general compiler pipeline. I'm reminded of Rust's recent initiative to rearchitect the compiler with a Rust-specific IR of its own (MIR). Here's an overview of how the compiler devs expect rustc to operate once this work is complete: https://github.com/rust-lang/rfcs/pull/1211#issuecomment-128... and here's a comment expanding on this overview: https://github.com/rust-lang/rfcs/pull/1211#issuecomment-130...
You might also be interested in this post, which goes into some more detail about HHBC and HHIR, and gives some examples of what it looked like about a year ago (which hasn't changed to terribly much): http://hhvm.com/blog/6323/the-journey-of-a-thousand-bytecode...