Evaluation of a just-in-time compiler retrofitted for PHP

Programmers 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 Web application development implies an opportunity to significantly enhance Web server throughput. This paper summarizes a study of the optimization of PHP script processing. We developed a PHP processor, P9, by adapting an existing production-quality just-in-time (JIT) compiler for a Java virtual machine, for which optimization technologies have been well-established, especially for server-side application. This paper describes and contrasts microbenchmarks and SPECweb2005 benchmark results for a well-tuned configuration of a traditional PHP interpreter and our JIT compiler-based implementation, P9. Experimental results with the microbenchmarks show 2.5-9.5x advantage with P9, and the SPECweb2005 measurements show about 20-30% improvements. These results show that the acceleration of dynamic scripting language processing does matter in a realistic Web application server environment. CPU usage profiling shows our simple JIT compiler introduction reduces the PHP core runtime overhead from 45% to 13% for a SPECweb2005 scenario, implying that further improvements of dynamic compilers would provide little additional return unless other major overheads such as heavy memory copy between the language runtime and Web server frontend are reduced.

[1]  Fritz Henglein,et al.  Global tagging optimization by type inference , 1992, LFP '92.

[2]  Jong-Deok Choi,et al.  Escape analysis for Java , 1999, OOPSLA '99.

[3]  Nikola Grcevski,et al.  Java Just-in-Time Compiler and Virtual Machine Improvements for Server and Middleware Applications , 2004, Virtual Machine Research and Technology Symposium.

[4]  Robert Cartwright,et al.  Soft typing , 2004, SIGP.

[5]  U. V. Ramana Some experiments with the performance of LAMP architecture , 2005, The Fifth International Conference on Computer and Information Technology (CIT'05).

[6]  Michiaki Tatsubori,et al.  Copy-on-write in the PHP language , 2009, POPL '09.

[7]  Karl-Filip Faxén Representation Analysis for Coercion Placement , 2002, SAS.

[8]  Sameh Elnikety,et al.  Performance Comparison of Middleware Architectures for Generating Dynamic Web Content , 2003, Middleware.

[9]  J. Benda Phalanger : Compiling and Running PHP Applications on the Microsoft . NET Platform , 2006 .

[10]  Benjamin Goldberg,et al.  Escape analysis on lists , 1992, PLDI '92.

[11]  Carey L. Williamson,et al.  A performance comparison of dynamic Web technologies , 2003, PERV.

[12]  Davide Ancona,et al.  RPython: a step towards reconciling dynamically and statically typed OO languages , 2007, DLS '07.

[13]  Michiaki Tatsubori,et al.  Highly scalable web applications with zero-copy data transfer , 2009, WWW '09.

[14]  Armin Rigo,et al.  Representation-based just-in-time specialization and the psyco prototype for python , 2004, PEPM '04.

[15]  Samuele Pedroni,et al.  PyPy's approach to virtual machine construction , 2006, OOPSLA '06.

[16]  Craig Chambers,et al.  The design and implementation of the self compiler, an optimizing compiler for object-oriented programming languages , 1992 .

[17]  Michael Franz,et al.  HotpathVM: an effective JIT compiler for resource-constrained devices , 2006, VEE '06.

[18]  Craig Chambers,et al.  Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches , 1991, ECOOP.

[19]  Jacques Garrigue,et al.  On the runtime complexity of type-directed unboxing , 1998, ICFP '98.

[20]  Angela Demke Brown,et al.  Inlining java native calls at runtime , 2005, VEE '05.

[21]  Michiaki Tatsubori,et al.  Performance Comparison of PHP and JSP as Server-Side Scripting Languages , 2008, Middleware.

[22]  Jim Hugunin Python and Java: The Best of Both Worlds , 1997 .

[23]  Xavier Leroy,et al.  Unboxed objects and polymorphic typing , 1992, POPL '92.