PHP is a dynamically typed programming language commonly used for the server-side implementation of web applications.
Approachability and ease of deployment have made PHP one of the most widely used scripting languages for the web, powering important web applications such as WordPress, Wikipedia, and Facebook.
PHP's highly dynamic nature, while providing useful language features, also makes it hard to optimize statically.
This paper reports on the implementation of purely static bytecode optimizations for PHP 7, the last major version of PHP. We discuss the challenge of integrating classical compiler optimizations, which have been developed in the context of statically-typed languages, into a programming language that is dynamically and weakly typed, and supports a plethora of dynamic language features. Based on a careful analysis of language semantics, we adapt static single assignment (SSA) form for use in PHP. Combined with type inference, this allows type-based specialization of instructions, as well as the application of various classical SSA-enabled compiler optimizations such as constant propagation or dead code elimination.
We evaluate the impact of the proposed static optimizations on a wide collection of programs, including micro-benchmarks, libraries and web frameworks.
Despite the dynamic nature of PHP, our approach achieves an average speedup of 50% on micro-benchmarks, 13% on computationally intensive libraries, as well as 1.1% (MediaWiki) and 3.5% (WordPress) on web applications.
Sun 5 Feb Times are displayed in time zone: Saskatchewan, Central America change
|13:30 - 13:55|
|Compile-Time Function Memoization|
|13:55 - 14:20|
|One Compiler: Deoptimization to Optimized Code|
Christian Wimmer, Vojin JovanovicOracle Labs, Erik EcksteinOracle Labs, USA, Thomas WuerthingerOracle LabsDOI
|14:20 - 14:45|
|Static Optimization in PHP 7|
Nikita PopovTU Berlin, Germany, Biagio CosenzaTU Berlin, Germany, Ben JuurlinkTU Berlin, Germany, Dmitry StogovZend Technologies, RussiaDOI
|14:45 - 15:10|
|From Functional Programs to Pipelined Dataflow Circuits|