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 FebDisplayed time zone: Saskatchewan, Central America change
13:30 - 15:10 | |||
13:30 25mTalk | Compile-Time Function Memoization Research Papers DOI | ||
13:55 25mTalk | One Compiler: Deoptimization to Optimized Code Research Papers Christian Wimmer , Vojin Jovanovic Oracle Labs, Erik Eckstein Oracle Labs, USA, Thomas Wuerthinger Oracle Labs DOI | ||
14:20 25mTalk | Static Optimization in PHP 7 Research Papers Nikita Popov TU Berlin, Germany, Biagio Cosenza TU Berlin, Germany, Ben Juurlink TU Berlin, Germany, Dmitry Stogov Zend Technologies, Russia DOI | ||
14:45 25mTalk | From Functional Programs to Pipelined Dataflow Circuits Research Papers DOI |