Original link: http://coderoncode.com/2013/07/24/introduction-hhvm.html "HHVM (HIpHop Virtual Machina) translates the PHP code into a high-level bytecode (generally considered an intermediate language). The bytecode is then dynamically converted to x64 machine code at runtime by the JIT (just-in-time) compiler. Based on this consideration, HHVM is similar to virtual machines in other languages, including C#/CLR and JAVA/JVM. ” A bit of a long history In the early 2008 the Facebook site worked on hiphop (a PHP execution engine, now hphp). The original motive was to convert a large amount of PHP code from the Facebook site into C + + code to conserve resources and improve application performance. The original version is HPHPC (a compiler that translates PHP code into C + + code). Over the next two years the Facebook site continued to work on HipHop, when the HipHop increased HPHPI (a hphp "development model" version) and HPHPD (HipHop debugger). PHP applications running on the hiphop platform allow developers to view and step through the code and debug interactively. At its peak, the PHP code running on hiphop is 6 times times more powerful than the PHP code running on the Zend engine. However, there are still several drawbacks to the first iteration of hiphop: 1, HPHPC not fully support the PHP language, the most obvious is not support create_function and eval these two functions. Admittedly, I don't think it's a bad thing for a function that doesn't support eval. 2. Facebook developers must maintain two different engines (HPHPC and HPHPI), which results in repetitive work and wasted resources. 3. Finally, HPHPC needs a completely different deployment process, which will hinder it from being adopted by PHP developers. In light of these issues, Facebook took two key actions in the early 2010. One is to open up the hiphop platform, open source, a project that is a great way to build a community around this project and get help from outside the community. Second, Facebook started the development of HipHop in the modern version, which is HHVM (HipHop virtual machine). HHVM improves the robustness of HPHPC and corrects many critical issues. HHVM is built on top of HPHPC and works by converting PHP code into high-level bytecode (an intermediate language). Such bytecode is dynamically converted to machine code at runtime by the JIT (just-in-time) compiler. If you're like me, you might have a vague memory for bytecode, machine code, and Just-in-time compilers. So let's take a moment off the subject and quickly review these concepts and explain how they play a pivotal role in HHVM. Byte code, machine code and JIT, OH, my ...! bytecode: It is a code that people do not understand and is designed to be executed efficiently by the interpreter or compiler. When HHVM first imported our project, it converted all the PHP code into an intermediate form such as bytecode. The resulting bytecode is independent of the specific type of computer structure, so it is easy to migrate between different systems. Machine code: It is a set of instructions that are designed to be executed directly by the CPU. If you've ever played assembly (who hasn't played?) ), you will be able to understand very well what is the machine code. For those of you who are not interested in playing assembly or similar languages, the machine code is generated by the compiler or interpreter and can be executed directly by the CPU. JIT (Just in time) compiler: The Just in time compilation technique is a technique used to improve software performance. It is implemented by compiling the bytecode stored in memory during execution, and the JIT compiler imports the bytecode and compiles the required portions. The performance and speed with which these technologies are applied can provide core benefits for hiphop and subsequent HHVM. Maintain a PHP code base while implementing a compiled application that is comparable in performance. The current HHVM basically supports the entire PHP5.4 version, however HHVM still has many bugs that hinder the execution of some applications. For this reason, the goal of the Facebook company is to allow the top 20 PHP applications of open source to run on HHVM. The first most popular application to run on is WordPress. Next Now we have a good understanding of what HHVM is doing and its advantages, and we can easily start testing for the applications that run on it. In the next article, I'll show you how to install HHVM on a virtual machine, run benchmarks on your application, and finally (hand-folded) to show you how to run Magento on HHVM. For more articles please follow my personal blog: http://www.nomoneynowife.com |