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

PHP Episodio VII: El Despertar de la Fuerza

PHP Episodio VII: El Despertar de la Fuerza

267ee9b8bfeb0c72b5dbe643bbc4433b?s=128

César Suárez Ortega

February 24, 2016
Tweet

Transcript

  1. None
  2. None
  3. csuarez tharandur BEET.TECH

  4. None
  5. None
  6. None
  7. None
  8. None
  9. Novedades en PHP 5.x PHP 5.3  Namespaces: use keyword  Closures

    PHP 5.4  Traits  Built-in server
  10. Novedades en PHP 5.x PHP 5.5  Generators  finally keyword  PHP

    5.6 Variadic functions: ... Keyword phpdbg
  11. None
  12. None
  13. Hiphop HPHPc Compilador de PHP a C++  En tiempo de

    ejecución (JIT compiler) HPHPi Intérprete para desarrollo Descontinuado
  14. Hiphop vs PHP 5 http://php.webtutor.pl/en/2011/05/17/drupal-hiphop-for-php-vs-apc-benchmark/

  15. None
  16. hhvm Máquina virtual  ¡No es un conversor de código! Compilador

    JIT: PHP a byte code (HHBC)  HHBC en código máquina x64 Optimización al vuelo Detección de zonas calientes
  17. Hhvm vs hpHpC http://hhvm.com/blog/2027/faster-and-cheaper-the-evolution-of-the-hhvm-jit

  18. Hhvm parity http://hhvm.com/blog/2813/we-are-the-98-5-and-the-16

  19. Caso real: etSy https://codeascraft.com/2015/04/06/experimenting-with-hhvm-at-etsy/

  20. Caso real: etSy https://codeascraft.com/2015/04/06/experimenting-with-hhvm-at-etsy/  La migración no es trivial Problemas

    con las extensiones
  21. Caso real: wikipedia https://blog.wikimedia.org/2014/12/29/how-we-made-editing-wikipedia-twice-as-fast/ Ahorro en infraestructuras Ayuda directa de

    Facebook
  22. None
  23. Hack Superconjunto de PHP  HHVM ejecuta Hack y PHP https://learnxinyminutes.com/docs/hack/

  24. Hack

  25. Hack

  26. None
  27. None
  28. performance https://kinsta.com/blog/the-definitive-php-7-final-version-hhvm-benchmark/

  29. performance https://kinsta.com/blog/the-definitive-php-7-final-version-hhvm-benchmark/

  30. performance https://kinsta.com/blog/the-definitive-php-7-final-version-hhvm-benchmark/

  31. performance https://kinsta.com/blog/the-definitive-php-7-final-version-hhvm-benchmark/

  32. Scalar Type Hints <?php declare(strict_types=1); class ElePHPant { public $name,

    $age, $cuteness, $evil; public function __construct(string $name, int $age, float $cuteness, bool $evil) { $this->name = $name; $this->age = $age; $this->cuteness = $cuteness; $this->evil = $evil; } }
  33. ReturN Type Hints <?php function foo(): array { return [];

    } function foo2(): DateTime { return null; // invalid } function &array_sort(array &$data): array { return $data; }
  34. Spaceship operatoR // Si $a < $b devuelve -1 //

    Si $a = $b devuelve 0 // Si $a > $b devuelve 1 function compare(int $a, int $b): int { return $a <=> $b; } unicode codePoint echo "\u{9999}"; //prints 香
  35. Null coalesce operator $var = $value1 ?? $value2 ?? $value3;

    Bind closure on Call $three = new Value(3); $four = new Value(4); $closure = function ($delta) { var_dump($this->getValue() + $delta); }; $closure->call($three, 4); // prints 7 $closure->call($four, 4); // prints 8
  36. Group use declarations use Doctrine\Common\Collections\Expr\Comparison; use Doctrine\Common\Collections\Expr\Value; use Doctrine\Common\Collections\Expr\CompositeExpression; use

    Doctrine\Common\Collections\Expr\{ Comparison, Value, CompositeExpression }; Anonymous classes $util->setLogger(new class { public function log($msg) { echo $msg; } });
  37. Engine exceptions BaseException (abstract) ├── Exception extends BaseException ├── ErrorException

    extends Exception └── RuntimeException extends Exception └── EngineException extends BaseException ├── TypeException extends EngineException ├── ParseException extends EngineException └── AssertionError extends EngineException
  38. gracias