skip to main content
10.1145/2384616.2384658acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

The HipHop compiler for PHP

Published:19 October 2012Publication History

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.

References

  1. APC: Alternative PHP Cache. Web site:\ http://php.net/manual/en/book.apc.php.Google ScholarGoogle Scholar
  2. 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 ScholarGoogle Scholar
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. Facebook, Inc. The HipHop compiler for PHP. Available at: https://github.com/facebook/hiphop-php/wiki/.Google ScholarGoogle Scholar
  7. Facebook, Inc. The HipHop Virtual Machine.newline Web site: https://www.facebook.com/note.php?newline note_id=10150415177928920, December 2011.Google ScholarGoogle Scholar
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. GCC. Gnu Compiler Collection. Web site: http://gcc.gnu.org.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. Hyves, Inc. HipHop for PHP at Hyves. Web site: http://hyvesblogonproductdevelopment.blogspot.com/2011/10/hiphop-for-php-at-hyves.html, October 2011.Google ScholarGoogle Scholar
  12. M. Lemos. PHP compiler performance. Available at: http://www.phpclasses.org/blog/post/117-PHP-compiler-performance.html, February 2010.Google ScholarGoogle Scholar
  13. J. Misek. Improved wordpress performance with phalanger. Web site: http://www.php-compiler.net/blog/2011/phalanger-wordpress-performance, 2011.Google ScholarGoogle Scholar
  14. J. K. Ousterhout. Scripting: Higher-level programming for the 21st century. Computer, 31:23--30, March 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. PHP eval. Web site: http://php.net/manual/en/function.eval.php.Google ScholarGoogle Scholar
  16. Project Zero. Web site: https://www.projectzero.org/php/.Google ScholarGoogle Scholar
  17. Quercus: PHP in Java. Web site: http://www.caucho.com/resin-3.0/quercus/.Google ScholarGoogle Scholar
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. Roadsend compiler. Web site: http://www.roadsend.com.Google ScholarGoogle Scholar
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. The Computer Language Benchmarks Game. Web site: http://shootout.alioth.debian.org/.Google ScholarGoogle Scholar
  23. S. Warner and J. Worley. SPECweb2005 in the real world: Using IIS and PHP. In Proceedings of SPEC Benchmark Workshop, 2008.Google ScholarGoogle Scholar
  24. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. Zend PHP. Web site: http://php.net.Google ScholarGoogle Scholar

Index Terms

  1. The HipHop compiler for PHP

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      OOPSLA '12: Proceedings of the ACM international conference on Object oriented programming systems languages and applications
      October 2012
      1052 pages
      ISBN:9781450315616
      DOI:10.1145/2384616
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 47, Issue 10
        OOPSLA '12
        October 2012
        1011 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/2398857
        Issue’s Table of Contents

      Copyright © 2012 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 19 October 2012

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate268of1,244submissions,22%

      Upcoming Conference

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader