Visit the post for more.
Overview
The article discusses performance improvements made to HPHPi, the HipHop interpreter for PHP, to enhance its speed and efficiency for developers. Key optimizations include sharing parse trees, moving file parsing out of critical regions, and various AST node specializations, resulting in a significant performance increase.
What You'll Learn
1
How to share parse trees among different sandboxes to reduce parsing time
2
Why moving PHP file parsing out of critical regions can improve performance
3
How to implement AST node specialization for better execution speed
Key Questions Answered
What optimizations were made to improve HPHPi performance?
The article details several optimizations for HPHPi, including sharing parse trees among sandboxes, moving file parsing out of critical regions, AST node specialization, and caching built-in function metadata. These changes collectively enhance execution speed and reduce memory usage.
What was the performance increase achieved after the optimizations?
After implementing the optimizations, the execution time of bench.php improved from 72.33 seconds to 33.5 seconds, representing a 53.6% increase in speed. This significant reduction demonstrates the effectiveness of the changes made to HPHPi.
Key Statistics & Figures
Execution time before optimization
72.33 seconds
This was the time taken to execute bench.php prior to the performance improvements.
Execution time after optimization
33.5 seconds
This is the new execution time for bench.php after the optimizations, showing a 53.6% increase in speed.
Technologies & Tools
Backend
Hphpi
The HipHop interpreter for PHP, used for writing, debugging, and testing PHP code.
Key Actionable Insights
1Implementing shared parse trees can drastically reduce the time spent on parsing files across multiple sandboxes.This is particularly useful in large codebases where many files remain unchanged. By reusing parse trees, developers can experience faster turnaround times.
2Moving PHP file parsing out of critical regions allows for parallel processing of multiple files.This optimization can significantly improve the performance of HPHPi, especially in environments with high concurrency.
3Specializing AST nodes can lead to better execution speeds and reduced memory usage.By optimizing common operations like increment and decrement, developers can enhance the overall performance of PHP code execution.
Common Pitfalls
1
Failing to optimize file parsing can lead to significant delays in execution time.
This happens when developers do not consider the impact of parsing on performance, especially in large codebases where many files are frequently accessed.