Monday, July 29, 2013

Published 8:44 AM by

Facebook 9-fold faster development language PHP

Facebook 9-fold faster development language PHP


       Social network Facebook will continue with the popular medium of web development PHP, seeking expedite its work on existing equipment. On the eve of Facebook said that developed the PHP Virtual Machine, which can execute instructions in PHP to 9 times faster than a conventional interpreter PHP. "Our goal - to make the PHP is really fast," - says Facebook engineer Joel Pobar. Earlier, the company has already applied Facebook tricks to speed up PHP and increase its scalability. For example, the virtual machine was created HipHop, which until earlier this year was actively used on servers Facebook. Note that PHP is an interpreted language, that is, its source code is converted directly to a processor and runs the computer .

       In general, this means that the scripting languages ​​do not translate into binary structure, and can not run as fast as the low-level languages, the same as C or C + +, but worldwide, many fans PHP, as this language is simple in design and has a rich features. To facilitate working with PHP on vysokonarguzhennyh projects, such as Facebook, was created by Larry HipHop, which aired PHP to C + + code to the one carried out faster processor. In Facebook said that until recently, they arranged HipHop, but with the growth of the user base, and he no longer cope with the service for more than a billion users. New virtual machine PHP is a development of HipHop and works on the principle of Just-in-Time compiler.

       It converts on the fly PHP-code to bytecode, and stores the most popular compiled fragments in memory for their early call as needed. On a similar algorithm works and Java-server environment. "Just-in Time allows a virtual machine to make more intelligent decisions. For example, if there is a call in PHP MySQL, the compiler defines the type of data output, after which it generates or is the code that is best suited to handle these types of data, "- says Pobar.

      Thus, on Facebook saying that although the compiler is smart enough to understand the types of data or to understand which parts of the code, it is better to keep alert, full of success still depends on the code implementation hands of the programmer. Company has already placed source virtual machine in the resource GitHub - https://github.com/Facebook/hiphop-php/wiki The company said that the use of a virtual machine is suitable for large projects with a high level of dynamic data generation.
      edit