1 / 36

Zeev Suraski ISOC WordPress Conference 2016, Tel Aviv

Understand the transformation of PHP over the years from PHP 3 to PHP 7.1, emphasizing performance improvements and important new features.

Download Presentation

Zeev Suraski ISOC WordPress Conference 2016, Tel Aviv

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Zeev SuraskiISOC WordPress Conference 2016, Tel Aviv

  2. About Me • 3 daughters • Photography enthusiast • Crazy about spicy foods • Programming since the age of 12 • Last thing I did before getting involved with PHP was C++ CGIs (no!)

  3. How I got involved

  4. A Humble Beginning

  5. PHP’s popular. Really.

  6. Evolution

  7. PHP 3 Released: June 1998 New Features: Full fledged language Easily extensible

  8. PHP 4 Released: May 2000 New Features: Zend Engine Fast Modular Sessions Downwards compatibility (!) Language plugins

  9. PHP 5 5.0: July 2004 New “true“ object model Not Slower!

  10. PHP Performance Evolutionbench.php (lower is better)

  11. Putting Things in Perspective

  12. Php 6

  13. The Premise

  14. Full Language-Level Unicode

  15. What Ended Up Happening Bonus: Roughly doubled memory footprint.

  16. The End http://bit.ly/php6whathappened

  17. PHP 7

  18. Leading up to PHP 7 2012: Research PHP+JITbegins, led by DmitryStogov 2014:No performance gains realized for real-world workloads!

  19. Post-JIT Timeline • Compiled core • Ran bench.php • Ran WordPress • Merged back to master as base for PHP 7 (after vote) • Moved from POC to public community project • Split from mainstream PHP • Internals focus only (no new features) • Stay 100% compatible

  20. Performance more than doubled since phpng published

  21. What Made the Difference? Memory Consumption of key Data Structures (bytes) Memory Manager CPU Overhead (WP) 20% 5% PHP7 PHP5

  22. PHP 7: What’S IN IT FOR ME?

  23. It’s FAST

  24. PHP Performance Evolutionbench.php (lower is better)

  25. Badoo Case Study • Estimated $1M plus plus $100K/yr savings on App Server Cluster

  26. Tumblr Case Study “Not only were our servers serving pages twice as fast, they were doing it using half the amount of CPU resources.”

  27. Real World Application Benchmarks(% improvement vs. PHP 5.6)

  28. Real World Application Benchmarks(% improvement vs. PHP 5.6)

  29. More Info • http://bit.ly/php7perf • http://bit.ly/php7mandel

  30. Easily Recover from Errors • Many E_ERRORS and E_RECOVERABLE_ERRORs are now exceptions. try { call_method(null);// oops! } catch (EngineException $e){ echo"Exception: {$e->getMessage()}\n"; } • Significantly easier vs. error handler

  31. Return Type Declarations & Scalar Type Hints • Declare type of return value of functions<?phpfunctionfoobar():int{return 1.0;} • New Scalar Type Hints. In two flavors.<?phpfunction add(int$a,int$b):int{return$a+$b;}

  32. Zero Cost assert() (expectations) • assert() is a language construct in PHP 7 • Configurable for dev/prod: • zend.assertions = 0 → completely ignored (prod) • zend.assertions = 1 → assertions enabled (dev/test) • First arg can be an expression • Second arg can be an exception

  33. Other Notable New Features • The Spaceship Operator $x <=> $y • Uniform Variable Syntax • Abstract Syntax Tree • Filtered Unserialize • The Null Coalesce operator ($x ?? $y) ~= ($x ? $x : $y) • Full List: http://bit.ly/php7news • $foo->$bar['baz'] • $foo->{$bar['baz']} (5.x) • ($foo->$bar)['baz'] (7.0+)

  34. Going forward

  35. PHP 7.1 • More Performance Gains • Multi-catch • Void return types • Shortened list() syntax

  36. תודה!zeev@zend.com@zeevs

More Related