HipHop for PHP
Encyclopedia
HipHop for PHP is a source code transformer
Source-to-source compiler
A source-to-source compiler is a type of compiler that takes a high level programming language as its input and outputs a high level language. For example, an automatic parallelizing compiler will frequently take in a high level language program as an input and then transform the code and annotate...

 for PHP
PHP
PHP is a general-purpose server-side scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document...

 script code. HipHop programmatically transforms PHP source code into highly optimized C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 and then uses g++ to compile it to machine code
Machine code
Machine code or machine language is a system of impartible instructions executed directly by a computer's central processing unit. Each instruction performs a very specific task, typically either an operation on a unit of data Machine code or machine language is a system of impartible instructions...

. HipHop includes a code transformer, a reimplementation of PHP's runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.

HipHop for PHP can substantially increase the speed of PHP applications. Improvements of web page generation throughput by factors of 2 to 6 have been observed.

HipHop was created by Facebook
Facebook
Facebook is a social networking service and website launched in February 2004, operated and privately owned by Facebook, Inc. , Facebook has more than 800 million active users. Users must register before using the site, after which they may create a personal profile, add other users as...

 to save resources on its servers. It is being distributed with its over 300,000 lines of source code written in C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 and C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 as free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

 under the terms of version 3.01 of the PHP License
PHP License
The PHP License is the software license under which the PHP scripting language is released. The PHP License is a non-copyleft free software license according to the Free Software Foundation and an open source license according to the Open Source Initiative...

.

Facebook has also developed HPHPi, which is an experimental interpreter designed for development with no need to compile the PHP source code before running it.

History

Initially, HipHop was developed at Facebook under the lead of Haiping Zhao on CentOS
CentOS
CentOS is a free operating system based on Red Hat Enterprise Linux . It exists to provide a free enterprise class computing platform and strives to maintain 100% binary compatibility with its upstream distribution...

 and Fedora
Fedora (operating system)
Fedora is a RPM-based, general purpose collection of software, including an operating system based on the Linux kernel, developed by the community-supported Fedora Project and sponsored by Red Hat...

 systems. It had been under development for two years already when the release as free software under the PHP License was announced for 2 February 2010. Due to technical difficulties, Facebook slipped the release date by 18 days, releasing on 20 February to the public Git
Git (software)
Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on...

 repository.

Using HipHop for PHP

HipHop for PHP is an open source project, available from GitHub under the open source PHP license.

HipHop currently supports PHP version 5.2 and will be updated to support 5.3.

HipHop has been developed on CentOS and Fedora; building on other operating systems may not work at present, although support may be added in the future. At present, HipHop can only run on 64-bit architectures.

HipHop is a considerable improvement for running PHP projects with a reduced memory footprint and adding TBB
Intel Threading Building Blocks
Intel Threading Building Blocks is a C++ template library developed by Intel Corporation for writing software programs that take advantage of multi-core processors...

's parallel_for to HipHop gives an even more considerable speed-up and a significant decrease in memory consumption.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK