Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHP7 & Symfony 2 @ Symfony Barcelona May meetup

PHP7 & Symfony 2 @ Symfony Barcelona May meetup

Talk about PHP7 and Symfony 2 at the Symfony Barcelona May meetup with quite a lot more benchmarks than in my previous PHP7 talk. On top of that, PHP7 is now feature complete so this is what we are going to get!

8f2089782f2711659072020ad7227aff?s=128

Albert Casademont

May 22, 2015
Tweet

Transcript

  1. PHP7 & Symfony 2

  2. That's me! Albert Casademont ulabox.com @acasademont

  3. None
  4. None
  5. None
  6. HipHop Virtual Machine HipHop for PHP

  7. None
  8. PHP6 PHPNG

  9. ¡PHP7!

  10. but first...

  11. Get PHP 5.6 PLEASE

  12. PHP7 a.k.a. PHPNG

  13. Internals heavily modified data structs (current extensions won't work) call

    frame optimization new memory manager we finally have an AST! no JIT (yet)
  14. Internals Immutable arrays PCRE with JIT new JSON parser ...and

    lots more (watch Dmitry Stogof's talk on PHP7 internals for more!)
  15. Removed features mysql extension :'( ereg extension ASP style tags

    ...and many more
  16. None
  17. null coalesce https://wiki.php.net/rfc/isset_ternary

  18. None
  19. uniform variable https://wiki.php.net/rfc/uniform_variable_syntax

  20. None
  21. engine exceptions https://wiki.php.net/rfc/engine_exceptions_for_php7

  22. None
  23. return types!!! https://wiki.php.net/rfc/return_types

  24. None
  25. None
  26. scalar type hinting!!! https://wiki.php.net/rfc/scalar_type_hints_v5

  27. x10

  28. None
  29. Scalar type hinting Most wanted feature EVER! 2 flavors: weak

    & strict declare(strict_types=1); weak => casting strict => error
  30. However...

  31. Userland BC breaks New reserved keywords int, float, bool, string,

    true, false, null Symfony Validator BC Break!! True => IsTrue False => IsFalse Null => IsNull Available in SF >= 2.6.8, 2.3.29 LTS
  32. None
  33. Test environment VM Debian 8 1GB RAM, 1 core, SSD

    ulabox.com sf2 index / product page (prod) sf2 demo bundle (dev), composer update PHP 5.5 / 5.6 / 7.0 opcache.validate_timestamps = 0 opcache.enable_file_override = 1 HHVM 3.7 hhvm.server_stat_cache = 1 No extensions! (APCu) Nginx, Redis, Solr, MySQL
  34. PHP 5.3 PHP 5.4 PHP 5.5 PHP 5.6 PHP 7.0

    HHVM 3.7 0 0.5 1 1.5 2 2.5 2.22 1.83 1.78 1.75 0.83 0.3 Time (seconds) Bench.php
  35. PHP 5.3 PHP 5.4 PHP 5.5 PHP 5.6 PHP 7.0

    HHVM 3.7 0 2 4 6 8 10 12 14 13.25 12.75 12.5 12.5 8.25 7.8 Memory consumption (MB) Bench.php
  36. PHP 5.3 PHP 5.4 PHP 5.5 PHP 5.6 PHP 7.0

    HHVM 3.7 0 5 10 15 20 25 30 35 29.97 29.91 29.17 12.47 17.86 Time (seconds) composer update --profile
  37. PHP 5.3 PHP 5.4 PHP 5.5 PHP 5.6 PHP 7.0

    HHVM 3.7 0 100 200 300 400 500 600 700 800 900 812 812 812 551 316 Memory consumption (MB) composer update --profile
  38. PHP 5.5 PHP 5.6 PHP 7.0 HHVM 3.7 0 5

    10 15 20 25 30 26 24 13 19 Time (milliseconds) SF2 - AcmeDemo
  39. PHP 5.5 PHP 5.6 PHP 7.0 HHVM 3.7 0 2

    4 6 8 10 12 10.75 10.75 4.75 0.48 Memory consumption (MB) SF2 - AcmeDemo
  40. PHP 5.5 PHP 5.6 PHP 7.0 HHVM 3.7 0 10

    20 30 40 50 60 70 80 90 81 76 44 56 Time (milliseconds) SF2 – ulabox index
  41. PHP 5.5 PHP 5.6 PHP 7.0 HHVM 3.7 0 2

    4 6 8 10 12 14 16 18 20 17.25 17.25 12 4.19 Memory consumption (MB) SF2 – ulabox index
  42. PHP 5.5 PHP 5.6 PHP 7.0 HHVM 3.7 0 20

    40 60 80 100 120 109 103 60 72 Time (milliseconds) SF2 – ulabox product
  43. PHP 5.5 PHP 5.6 PHP 7.0 HHVM 3.7 0 5

    10 15 20 25 20.75 20.5 14 5 Memory consumption (MB) SF2 – ulabox product
  44. Resources https://wiki.php.net/phpng https://wiki.php.net/rfc http://news.php.net/php.internals https://joind.in/talk/view/12068 https://atlas.hashicorp.com/rasmu s/boxes/php7dev https://github.com/php/php-src

  45. gràcies ;)