What is HHVM (HipHop Virtual Machine)
Many of php developers heard about HHVM and tried to understand What is HHVM (HipHop Virtual Machine) ? In this article i am going to discus some basics about HHVM.
HHVM or HipHop Virtual Machine has been developed by Facebook. HHVM initally released on December 9, 2011 and the latest stable released on March 30, 2016. HHVM supports Hack, PHP 5 and PHP 7.
HHVM or HipHop Virtual Machine is an open-source virtual machine based on the concept of just-in-time (JIT) compliler which is designed for executing programs written in Hack and PHP. By using the just-in-time (JIT) compilation approach HHVM achieve superior performance and also maintain the development flexibility provided by PHP. HHVM execute the code 9 times faster than usual.
HHVM compiles PHP into an intermediate high-level bytecode (HHBC). HHBC is a bytecode format specifically created for HHVM. This HHBC bytecode is then translated into x64 machine code at runtime by a JIT compiler. At this point HHVM also performs some additional optimizations through a dynamic analysis of the translated This compilation process allows for all kind of optimizations which cannot be made in a statically compiled binary code, thus enabling higher performance of Hack and PHP codes.
Advantages of HHVM
- HHVM is faster than PHP.
- High perform with low usage of resources.
- Compile to HHBC a more effective native code.
- It recompile only file in which changes were made.
- Is is compaitable to almost open source CMS, E-Commerce and Frameworks like CodeIgniter, CakePHP, Laravel, Magento, Opencart etc.
Disadvantages of HHVM
- Compile time a little bit high.
- Facebook could not povide support for HHVM. Which slow down its growth.
- Support is not avilable for HHVM.
For more info read here
How to install HipHop Virtual Machine (HHVM) on Ubuntu ?
Its very easy to install the HHVM on Ubutnu. So lets start .
1) First we need to import HHVM repository’s GnuPG public keys our apt-key. For this use below command
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
2) Now add HHVM’s repository to our list. For this use below command
sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"
3) Now update your apt-get. For this use below command
4) Now install HHVM using below command
sudo apt-get install hhvm
This command will install HHVM on your machine. You can check the HHVM installation by using below command
This command will show you output like