ABSTRACT
Scripting languages are widely used to quickly accomplish a variety of tasks because of the high productivity they enable. Among other reasons, this increased productivity results from a combination of extensive libraries, fast development cycle, dynamic typing, and polymorphism. The dynamic features of scripting languages are traditionally associated with interpreters, which is the approach used to implement most scripting languages. Although easy to implement, interpreters are generally slow, which makes scripting languages prohibitive for implementing large, CPU-intensive applications. This efficiency problem is particularly important for PHP given that it is the most commonly used language for server-side web development. This paper presents the design, implementation, and an evaluation of the HipHop compiler for PHP. HipHop goes against the standard practice and implements a very dynamic language through static compilation. After describing the most challenging PHP features to support through static compilation, this paper presents HipHop's design and techniques that support almost all PHP features. We then present a thorough evaluation of HipHop running both standard benchmarks and the Facebook web site. Overall, our experiments demonstrate that HipHop is about 5.5x faster than standard, interpreted PHP engines. As a result, HipHop has reduced the number of servers needed to run Facebook and other web sites by a factor between 4 and 6, thus drastically cutting operating costs.
- APC: Alternative PHP Cache. Web site:\ http://php.net/manual/en/book.apc.php.Google Scholar
- J. Benda, T. Matousek, and L. Prosek. Phalanger: Compiling and running PHP applications on the Microsoft .NET platform. In Proceedings on the 4th International Conference on .NET Technologies, pages 11--20, 2006.Google Scholar
- P. Biggar, E. de Vries, and D. Gregg. A practical solution for scripting language compilers. In Proceedings of the ACM Symposium on Applied Computing, pages 1916--1923, 2009. Google ScholarDigital Library
- L. Damas and R. Milner. Principal type-schemes for functional programs. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 207--212, 1982. Google ScholarDigital Library
- S. Ducasse, O. Nierstrasz, N. Scharli, R. Wuyts, and A. P. Black. Traits: A mechanism for fine-grained reuse. ACM Trans. Program. Lang. Syst., 28:331--388, March 2006. Google ScholarDigital Library
- Facebook, Inc. The HipHop compiler for PHP. Available at: https://github.com/facebook/hiphop-php/wiki/.Google Scholar
- Facebook, Inc. The HipHop Virtual Machine.newline Web site: https://www.facebook.com/note.php?newline note_id=10150415177928920, December 2011.Google Scholar
- A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. W. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 465--478, 2009. Google ScholarDigital Library
- GCC. Gnu Compiler Collection. Web site: http://gcc.gnu.org.Google Scholar
- A. Homescu and A. Şuhan. HappyJIT: a tracing JIT compiler for PHP. In Proceedings of the 7th Symposium on Dynamic Languages, pages 25--36, 2011. Google ScholarDigital Library
- Hyves, Inc. HipHop for PHP at Hyves. Web site: http://hyvesblogonproductdevelopment.blogspot.com/2011/10/hiphop-for-php-at-hyves.html, October 2011.Google Scholar
- M. Lemos. PHP compiler performance. Available at: http://www.phpclasses.org/blog/post/117-PHP-compiler-performance.html, February 2010.Google Scholar
- J. Misek. Improved wordpress performance with phalanger. Web site: http://www.php-compiler.net/blog/2011/phalanger-wordpress-performance, 2011.Google Scholar
- J. K. Ousterhout. Scripting: Higher-level programming for the 21st century. Computer, 31:23--30, March 1998. Google ScholarDigital Library
- PHP eval. Web site: http://php.net/manual/en/function.eval.php.Google Scholar
- Project Zero. Web site: https://www.projectzero.org/php/.Google Scholar
- Quercus: PHP in Java. Web site: http://www.caucho.com/resin-3.0/quercus/.Google Scholar
- G. Richards, C. Hammer, B. Burg, and J. Vitek. The eval that men do: A large-scale study of the use of eval in JavaScript applications. In Proceedings of the 25th European Conference on Object-oriented Programming, pages 52--78, 2011. Google ScholarDigital Library
- A. Rigo and S. Pedroni. PyPy's approach to virtual machine construction. In Proceedings of the 21st ACM SIGPLAN Symposium on Object-oriented Programming Systems, Languages, and Applications, pages 944--953, 2006. Google ScholarDigital Library
- Roadsend compiler. Web site: http://www.roadsend.com.Google Scholar
- M. Tatsubori, A. Tozawa, T. Suzumura, S. Trent, and T. Onodera. Evaluation of a just-in-time compiler retrofitted for PHP. In Proceedings of the 6th ACM SIGPLAN/SIGOPS International Conference on Virtual Execution Environments, pages 121--132, 2010. Google ScholarDigital Library
- The Computer Language Benchmarks Game. Web site: http://shootout.alioth.debian.org/.Google Scholar
- S. Warner and J. Worley. SPECweb2005 in the real world: Using IIS and PHP. In Proceedings of SPEC Benchmark Workshop, 2008.Google Scholar
- K. Williams, J. McCandless, and D. Gregg. Dynamic interpretation for dynamic scripting languages. In Proceedings of the 8th IEEE/ACM International Symposium on Code Generation and Optimization, pages 278--287, 2010. Google ScholarDigital Library
- Zend PHP. Web site: http://php.net.Google Scholar
Index Terms
- The HipHop compiler for PHP
Recommendations
HHVM JIT: a profile-guided, region-based compiler for PHP and Hack
PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and ImplementationDynamic languages such as PHP, JavaScript, Python, and Ruby have been gaining popularity over the last two decades. A very popular domain for these languages is web development, including server-side development of large-scale websites. As a result, ...
The hiphop virtual machine
OOPSLA '14: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & ApplicationsThe HipHop Virtual Machine (HHVM) is a JIT compiler and runtime for PHP. While PHP values are dynamically typed, real programs often have latent types that are useful for optimization once discovered. Some types can be proven through static analysis, ...
Evaluation of a just-in-time compiler retrofitted for PHP
VEE '10: Proceedings of the 6th ACM SIGPLAN/SIGOPS international conference on Virtual execution environmentsProgrammers who develop Web applications often use dynamic scripting languages such as Perl, PHP, Python, and Ruby. For general purpose scripting language usage, interpreter-based implementations are efficient and popular but the server-side usage for ...
Comments