I'll be honest: I thought I was being messed with when I first heard about HipHop Virtual Machine (HHVM). Then I learned it was from the demented minds over at Facebook and I knew it was something I should learn more about.
Facebook is the Microsoft Solitaire of the 21st century. Just when computing started to get to geeky for the Silver Fox crowd, Facebook comes along and makes it fun again. Kinda like how MS Solitaire taught folks how to love the computer and use a mouse. The contrast to Facebook’s usability is that it takes a ton of work on the back end to achieve. Facebook is leading the way in this by creating open-source breakthroughs like React.js, The Wedge, and now HHVM.
Facebook originally designed HHVM in 2011 so it could scale to larger proportions using the exact same hardware. HHVM has gone through a few changes since launch, and the end result is basically a JIT (Just-In-Time compilation) that took Facebook’s PHP code and compiled it into machine code on the fly.
Now, this is a MASSIVE, big deal. Keep in mind that Machine Code is the code executed directly by the CPU itself. It’s really the ONLY code that actually runs on your system. All other code has to be converted to Machine Code.
Folks confuse Machine Code with Object Code and Assembly Code. Here’s the difference:
- Object Code is a piece of Machine Code for a certain module that will make up the complete product itself. Normally, offsets and placeholders are stored in Object Code.
- Assembly Code is really just a human-readable form (normally a 1:1 translation) of Machine Code expressed in mnemonics.
As a rule of thumb, the more human readable code is, the more work it is to get it to Machine Code. There’s a really fine line in making code easy to use, yet efficient enough so users apps run quickly.
With HHVM, Facebook has cut out the middleman of processing. Sounds groovy, right? Just like containers are changing data center design, HHVM can really do some amazing things for DevOps.
(Stay tuned, because in the next blog, I’m taking HHVM for a spin around Ye Olde Code Cave to see how it performs and if I can use it to replace other virtualization options out there!)—Jimmy Ray