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

PHP7 - Not for kids

PHP7 - Not for kids

Php 7 - Not for kids

Não é mais novidades que o PHP 7 veio com muitas melhorias, seja de performance, internas ou sintaxe, mas quais melhorias foram essas? Essa palestra irá abordar isso e também quais foram as mudanças do PHP 7.0 para o 7.1 e o que está por vir na versão 7.2.

Avatar for Marcos Felipe

Marcos Felipe

May 11, 2018
Tweet

More Decks by Marcos Felipe

Other Decks in Programming

Transcript

  1. Removed Extensions and SAPIs Extensions: ereg, mssql, mysql, sybase_ct. Servers

    APIs: aolserver, apache, apache_hooks, apache2filter, caudium, continuity, isapi, milter, nsapi, phttpd, pi3web, roxen, thttpd, tux, webjames.
  2. “ Errors and exceptions ╺ Any fatal error can be

    catch; ╺ E_STRICT notices have been reclassified to E_WARN and E_NOTICE; ╺ Fatal errors are or inherit the class "Error"; ╺ Syntax parsing errors generate "ParseError"; ╺ "Error" and "Exception" implement interface "Throwable".
  3. “ Scalar type hints * Only non-NaN floats between PHP_INT_MIN

    and PHP_INT_MAX accepted. † Non-numeric strings not accepted. Numeric strings with trailing characters are accepted, but produce a notice. ‡ Only if it has a __toString method.
  4. “ 64-bit support ╺ Strings greater than 2³¹; ╺ Large

    file support (LFS); ╺ 64-bit integer support.
  5. “ AST PHP 5 PHP 7 PHP Parser Opcodes Execution

    PHP Parser AST Opcodes Execution
  6. “ Hashtable [0]: empty [1]: empty [2]: empty [3]: empty

    “foo” hash Credits: Nikita Popov
  7. “ Hashtable [0]: empty [1]: [2]: empty [3]: empty “foo”

    hash data key: “foo” zval Credits: Nikita Popov
  8. “ Hashtable [0]: empty [1]: [2]: empty [3]: empty “foo”

    hash data key: “foo” zval “bar” Credits: Nikita Popov
  9. “ Hashtable [0]: empty [1]: [2]: empty [3]: empty “foo”

    hash data key: “foo” “bar” next data key: “bar” next = NULL Credits: Nikita Popov
  10. “ Hashtable [0]: empty [1]: [2]: empty [3]: empty “foo”

    hash data key: “foo” “bar” next data key: “bar” next = NULL head tail
  11. “ Hashtable [0]: empty [1]: [2]: empty [3]: “foo” hash

    data key: “foo” “bar” next data key: “bar” next = NULL “baz” data key: “baz” next = NULL Credits: Nikita Popov
  12. “ Hashtable [0]: empty [1]: [2]: empty [3]: “foo” hash

    data key: “foo” next = NULL TOMBSTONE “baz” data key: “baz” next = NULL Credits: Nikita Popov
  13. “ Hashtable ╺ Hashtable reduced from 72 to 56 bytes;

    ╺ Bucket reduced from 72 to 32 bytes.
  14. “ Data structure optimization ╺ Average of 20% of the

    time in PHP 5 was memory allocation; ╺ Reduced number of allocations; ╺ Reduced memory consumption; ╺ Reduced number of indirect; ╺ Strings are refcounted.
  15. “ zval Credits: Nikita Popov refcount=1 ty value (complex) complex

    data structure: string, array, object zval* $a
  16. “ zval Credits: Nikita Popov refcount=1 ty value (complex) complex

    data structure: string, array, object zval* $a
  17. “ zval Credits: Nikita Popov refcount=2 ty value (complex) complex

    data structure: string, array, object zval* $a zval* $b
  18. “ zval Credits: Nikita Popov type_info value (complex) zval* $a

    zval* $b refcount=2 complex data structure: string, array, object
  19. “ zval Credits: Nikita Popov type_info value (complex) $a $b

    refcount=2 complex data structure: string, array, object type_info value (complex)
  20. PHP5 Credits: Nikita Popov zval* refcount=1 ty value (simple) null,

    bool, int, float ╺ 1 memory allocation; ╺ 1 level of indirection; ╺ 40 bytes. type_info value (simple) null, bool, int, float PHP7 ╺ no memory allocation; ╺ without indirection; ╺ 16 bytes.
  21. PHP5 Credits: Nikita Popov zval* refcount=1 ty value (complex) ╺

    2 memory allocation; ╺ 2 levels of indirection; ╺ 40 bytes. type_info value (complex) PHP7 ╺ 1 memory allocation; ╺ 1 level of indirection; ╺ 24 bytes. complex data structure: string, array, object refcount=1 complex data structure: string, array, object
  22. “ PHP.NEXT ╺ Immutable classes and properties; ╺ Arrow functions;

    ╺ Traits with interfaces; ╺ Named parameters; ╺ Operator functions.