O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Php 7 hhvm and co

Present new things coming to PHP 7, and the alternative PHP implementations as well as less intrusive solutions to speed up PHP.

  • Seja o primeiro a comentar

Php 7 hhvm and co

  1. 1. Pierre Joye PHP7, hhvm & co PHP 7, HHVM & CO Pierre Joye
  2. 2. Pierre Joye PHP7, hhvm & co Pierre Joye @pierrejoye pierre@php.net http://www.slideshare.net/pierrej PHP Core developer Contributors to numerous OSS projects Portability fan
  3. 3. Pierre Joye PHP7, hhvm & co Stats
  4. 4. Pierre Joye PHP7, hhvm & co What‘s going in the php world? https://wiki.php.net/rfc/isset_ternary
  5. 5. Pierre Joye PHP7, hhvm & co PHP 5.3 2009 - 2014
  6. 6. Pierre Joye PHP7, hhvm & co PHP 5.4 Security fixes only
  7. 7. Pierre Joye PHP7, hhvm & co PHP 5.6.0 is out! (btw, 5.6.1 too)
  8. 8. Pierre Joye PHP7, hhvm & co 5 + 1 = 7
  9. 9. Pierre Joye PHP7, hhvm & co Roadmap
  10. 10. Pierre Joye PHP7, hhvm & co Features • Rewamped Engine • True 64bit support • Large string and LFS (Large file support) • Consistent variables syntax • No more fatal error on calling method on non object • New ?? operator • Many features under discussions
  11. 11. Pierre Joye PHP7, hhvm & co Recoverable error for non object
  12. 12. Pierre Joye PHP7, hhvm & co Recoverable error for non object <?php set_error_handler(function($code,$message) { var_dump($code, $message); }); $x= null; var_dump($x->method()); echo "Aliven"; https://wiki.php.net/rfc/catchable-call-to-member-of-non-object
  13. 13. Pierre Joye PHP7, hhvm & co Null Coalesce Operator (??)
  14. 14. Pierre Joye PHP7, hhvm & co Null Coalesce Operator (??) <?php $username = $_GET['user'] ?? 'nobody'; $username = isset($_GET['user']) ? $_GET['user'] : 'nobody'; // Method/function call $model = Model::get($id) ?? $default_model; if (($model = Model::get($id)) === NULL) { $model = $default_model; } // Chained $x = NULL; $y = NULL; $z = 3; var_dump($x ?? $y ?? $z); https://wiki.php.net/rfc/isset_ternary
  15. 15. Pierre Joye PHP7, hhvm & co PHP Language Specification https://github.com/php/php-langspec
  16. 16. Pierre Joye PHP7, hhvm & co Open & Public Specifications Competions++
  17. 17. Pierre Joye PHP7, hhvm & co
  18. 18. Pierre Joye PHP7, hhvm & co
  19. 19. Pierre Joye PHP7, hhvm & co (Most) Focus on Speed
  20. 20. Pierre Joye PHP7, hhvm & co
  21. 21. Pierre Joye PHP7, hhvm & co SPEED is NOT SCALE
  22. 22. Pierre Joye PHP7, hhvm & co SPEED is UX
  23. 23. Pierre Joye PHP7, hhvm & co Scale is Server Side Architecture (Apps, Ops, Net, …)
  24. 24. Pierre Joye PHP7, hhvm & co My code sucks.
  25. 25. Pierre Joye PHP7, hhvm & co Yours too.
  26. 26. Pierre Joye PHP7, hhvm & co Steroids++
  27. 27. Pierre Joye PHP7, hhvm & co So?
  28. 28. Pierre Joye PHP7, hhvm & co
  29. 29. Pierre Joye PHP7, hhvm & co
  30. 30. Pierre Joye PHP7, hhvm & co QB <?php class OilPaintFilter { /** @var int32 */ public $levels = 25; /** @var int32 */ public $filterSize = 5; /** * @engine qb * * @param image $dst * @param image $src * * @local float32[*][r,g,b,a] $bin * @local float32 $max_intensity * @local int32 $(current_index|max_index) * @local int32 $(filter_x|filter_y|filter_offset) * @local int32 $(x|y|x_limit|y_limit) * @local int32 $(width|height) * @local float32[r,g,b,a] $pixel * @local float32 $multiplier */ public function filter(&$dst, $src) {…
  31. 31. Pierre Joye PHP7, hhvm & co QB <?php function calc($n, &$a) { $b = 18; while($n) { $a = $b * $b * $b * $b; $n--; } } $n = 5000000; $a = 0; calc($n, $a); $end = microtime(true);
  32. 32. Pierre Joye PHP7, hhvm & co QB Source: http://php-qb.net/index.php/2-uncategorised/27-comparing-performance-in-qb-with-hhvm
  33. 33. Pierre Joye PHP7, hhvm & co Zephir
  34. 34. Pierre Joye PHP7, hhvm & co Zephir Optimization & code generation Compilation + optimization Native execution
  35. 35. Pierre Joye PHP7, hhvm & co Zephir namespace MyLibrary; class Filter { public function alpha(string str) { char ch; string filtered = ""; for ch in str { if (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') { let filtered .= ch; } } return filtered; } }
  36. 36. Pierre Joye PHP7, hhvm & co Zephir <?php $filter = new MyLibraryFilter(); echo $filter>alpha("01he#l.lo?/1");
  37. 37. Pierre Joye PHP7, hhvm & co PHP Alternative Implementations
  38. 38. Pierre Joye PHP7, hhvm & co PHP Alternative Implementations • PHP7 (formely known as phpng) • HHVM (native code) • Recki-ct (native code) • Phalanger (.net engine)
  39. 39. Pierre Joye PHP7, hhvm & co Recki-ct
  40. 40. Pierre Joye PHP7, hhvm & co Recki-CT PHP Cache Parser (AST in 7+) Recki IR JIT~ Native Code
  41. 41. Pierre Joye PHP7, hhvm & co Recki-ct php 5.5 Recki-CT hhvm 3.2 hippy-c qb simple() 139.63357 1.00000 8.30447 7.65693 8.35018 simplecall() 38.99476 FAIL 1.32552 1.00000 FAIL simpleucall() 54.02041 1.00000 3.52439 1.51072 47.91090 simpleudcall 52.14534 1.00000 3.75936 1.41614 47.55259 () mandel() 21.26249 1.00000 2.03372 2.11208 FAIL mandel_typ ed() 23.16553 1.00000 2.11128 2.09212 3.00061 mandel2() 24.43275 1.00000 2.57704 1.87802 FAIL mandel2_ty ped() 23.79989 1.00000 2.90105 1.57193 7.11054
  42. 42. Pierre Joye PHP7, hhvm & co Recki-ct php 5.5 Recki-CT hhvm 3.2 hippy-c qb ary(50000) 1.39338 FAIL 1.00000 4.47888 FAIL ary2(50000) 1.26952 FAIL 1.00000 2.28231 FAIL ary3(2000) 5.96015 FAIL 1.70997 1.00000 FAIL fibo(30) 39.48440 1.00000 1.60647 16.40883 FAIL hash1(50000) 1.70014 FAIL 1.00000 3.27314 FAIL hash2(500) 2.23648 FAIL 1.00000 1.30044 FAIL heapsort(2000 3.67800 FAIL 1.00000 4.96699 FAIL 0)
  43. 43. Pierre Joye PHP7, hhvm & co
  44. 44. Pierre Joye PHP7, hhvm & co HHVM PHP Cache Parser (AST in 7+) HHVM Opcodes Native Code Cache JIT ~
  45. 45. Pierre Joye PHP7, hhvm & co
  46. 46. Pierre Joye PHP7, hhvm & co PHP PHP Cache Parser (AST in 7+) OpCodes
  47. 47. Pierre Joye PHP7, hhvm & co Resources 5.5 + opcache : 33.26 [#/sec] 7 (October 2014) + opcache : 41.61 [#/sec] Hhvm (October 2014) : 57.74 [#/sec]
  48. 48. Pierre Joye PHP7, hhvm & co Resources • http://wiki.php.net/rfc/ • http://zephir-lang.com/ • http://www.slideshare.net/ircmaxell/high-performance- php-phpnw • https://github.com/google/recki-ct • http://blog.ircmaxell.com/2014/08/introducing-recki- ct.html • https://github.com/chung-leong/ qb/wiki/Introduction
  49. 49. Pierre Joye PHP7, hhvm & co Resources • https://wiki.php.net/rfc/phpng • https://wiki.php.net/rfc/abstract_syntax_tree • http://hhvm.com/blog/6323/the-journey-of-a- thousand-bytecodes
  50. 50. Pierre Joye PHP7, hhvm & co Resources • http://phpdbg.com/ • http://windows.php.net/qa/ • http://qa.php.net/

    Seja o primeiro a comentar

    Entre para ver os comentários

  • erbuc

    Oct. 15, 2014
  • basicsharp

    Oct. 15, 2014
  • nati921

    Oct. 15, 2014
  • FreedomKnight

    Dec. 3, 2014
  • c9s

    Dec. 8, 2014
  • yen3

    Dec. 23, 2014
  • jasperck

    Feb. 2, 2015
  • meabed

    Feb. 23, 2015
  • ThanakomSangnetra

    Jun. 27, 2015
  • zateraczosit

    Jun. 27, 2015
  • mixkhun

    Jun. 27, 2015
  • phamduonguit

    Sep. 20, 2015
  • gopalindians

    Nov. 6, 2015

Present new things coming to PHP 7, and the alternative PHP implementations as well as less intrusive solutions to speed up PHP.

Vistos

Vistos totais

3.965

No Slideshare

0

De incorporações

0

Número de incorporações

10

Ações

Baixados

42

Compartilhados

0

Comentários

0

Curtir

13

×