SlideShare ist ein Scribd-Unternehmen logo
1 von 61
PHP 7, HHVM & CO
#PHPKonf
Istanbul
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
PHP7, hhvm & co
Stats
PHP7, hhvm & co
Awesome new extension installer
https://github.com/FriendsOfPHP/pickle
PHP7, hhvm & co
What‘s going in the php world?
https://wiki.php.net/rfc/isset_ternary
PHP7, hhvm & co
PHP 5.3
2009 - 2014
PHP7, hhvm & co
PHP 5.4 and 5.5
Security fixes only
PHP7, hhvm & co
PHP 5.4
2012 - 2015
PHP7, hhvm & co
PHP 5.5
2013 - 2016
PHP7, hhvm & co
PHP 5.6.11 is out!
PHP7, hhvm & co
5 + 1 = 7
PHP7, hhvm & co
6.6.6
PHP7, hhvm & co
PHP 7.0.0beta2 yesterday!
PHP7, hhvm & co
PHP 7.0 – Future is now
PHP7, hhvm & co
PHP 7.0 – speed++
PHP7, hhvm & co
LIES, DAMN LIES AND BENCHMARKS
PHP7, hhvm & co
PHP7, hhvm & co
PHP7, hhvm & co
Features
• Rewamped Engine
• True 64bit support
• Large string and LFS (Large file support)
• Consistent variables syntax
• Error exception instead of fatal error
• Scalar type declarations
• Zero cost asserts
PHP7, hhvm & co
Features
• Secure RNG
• PHP4 constructors deprecated
• JIT enabled PCRE
• Removed ext/mysql, ext/ereg and more
• New ?? Operator
• New JSON parser
• Many other features, a lot already target 7.1
PHP7, hhvm & co
Error exception instead of fatal error
PHP7, hhvm & co
Error exception
https://wiki.php.net/rfc/catchable-call-to-member-of-non-object
<?php
try {
$x = null;
var_dump($x->method());
// The exception class name is EngineException
// in alpha1
} catch (Error $e) {
// pass
}
echo "Aliven";
PHP7, hhvm & co
Scalar Type Declarations
PHP7, hhvm & co
Scalar Type Declarations
<?php
declare(strict_types = 1);
function add(int $a, int $b) : int {
return $a + $b;
}
$x = add(1, 2);
// The exception class name TypeException
// in alpha1
$y = add(0.1, 0.2); // TypeError exception
https://wiki.php.net/rfc/scalar_type_hints_v5
PHP7, hhvm & co
Null Coalesce Operator (??)
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
PHP7, hhvm & co
PHP Language Specification
https://github.com/php/php-langspec
PHP7, hhvm & co
Open & Public Specifications
Competions++
PHP7, hhvm & co
PHP7, hhvm & co
PHP7, hhvm & co
(Most) Focus on Speed
PHP7, hhvm & co
PHP7, hhvm & co
SPEED is NOT SCALE
PHP7, hhvm & co
SPEED is UX
PHP7, hhvm & co
Scale is Server Side
Architecture (Apps, Ops, Net, …)
PHP7, hhvm & co
My code sucks.
PHP7, hhvm & co
Yours too.
PHP7, hhvm & co
Steroids++
PHP7, hhvm & co
So?
PHP7, hhvm & co
PHP7, hhvm & co
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) {…
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);
PHP7, hhvm & co
QB
Source: http://php-qb.net/index.php/2-uncategorised/27-comparing-performance-in-qb-with-hhvm
See http://benchmarksgame.alioth.debian.org/u32/performance.php?test=spectralnorm or other
PHP7, hhvm & co
Zephir
PHP7, hhvm & co
Zephir
Optimization & code generation
Compilation + optimization
Native execution
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;
}
}
PHP7, hhvm & co
Zephir
<?php
$filter = new MyLibraryFilter();
echo $filter>alpha("01he#l.lo?/1");
PHP7, hhvm & co
PHP Alternative Implementations
PHP7, hhvm & co
PHP Alternative Implementations
• HHVM (native code)
• Recki-ct (native code)
• Phalanger (.net engine)
PHP7, hhvm & co
PHP7, hhvm & co
HHVM
PHP Cache
Parser (AST in 7+)
HHVM Opcodes
Native Code
JIT ~
Cache
PHP7, hhvm & co
PHP7, hhvm & co
PHP
PHP Cache
Parser (AST in 7+)
OpCodes
PHP7, hhvm & co
Recki-ct
PHP7, hhvm & co
Recki-CT
PHP Cache
Parser (AST in 7+)
Recki IR
JIT~
Native Code
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
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
0)
3.67800 FAIL 1.00000 4.96699 FAIL
PHP7, hhvm & co
Resources
• http://wiki.php.net/rfc/
• http://zephir-lang.com/
• http://www.slideshare.net/ircmaxell/high-
performance-php-phpnw
• http://talks.php.net/fluent15#/
• https://github.com/google/recki-ct
• http://blog.ircmaxell.com/2014/08/introducing-
recki-ct.html
• https://github.com/chung-
leong/qb/wiki/Introduction
PHP7, hhvm & co
Resources
• https://edit.php.net/
• 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
• https://github.com/php/php-
src/blob/master/UPGRADING
• https://github.com/php/php-
src/blob/master/UPGRADING.INTERNALS
PHP7, hhvm & co
Resources
• http://phpdbg.com/
• http://windows.php.net/qa/
• http://qa.php.net/
• http://ongr.io
• http://aka.ms/AzureCodeManiac2015

Weitere ähnliche Inhalte

Was ist angesagt?

The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5Wim Godden
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)julien pauli
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architectureElizabeth Smith
 
How to inspect a RUNNING perl process
How to inspect a RUNNING perl processHow to inspect a RUNNING perl process
How to inspect a RUNNING perl processMasaaki HIROSE
 
Php7 HHVM and co
Php7 HHVM and coPhp7 HHVM and co
Php7 HHVM and coweltling
 
Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic  Perl ProgrammerModern Perl for the Unfrozen Paleolithic  Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl ProgrammerJohn Anderson
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6Wim Godden
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to productionSean Hess
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Wim Godden
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principlesPerl Careers
 
Zend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHPZend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHPAdam Englander
 
Preparing code for Php 7 workshop
Preparing code for Php 7 workshopPreparing code for Php 7 workshop
Preparing code for Php 7 workshopDamien Seguy
 
Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with phpElizabeth Smith
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門lestrrat
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)James Titcumb
 
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5Wim Godden
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsMark Baker
 

Was ist angesagt? (20)

Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architecture
 
How to inspect a RUNNING perl process
How to inspect a RUNNING perl processHow to inspect a RUNNING perl process
How to inspect a RUNNING perl process
 
Php7 HHVM and co
Php7 HHVM and coPhp7 HHVM and co
Php7 HHVM and co
 
Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic  Perl ProgrammerModern Perl for the Unfrozen Paleolithic  Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl Programmer
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
 
Zend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHPZend con 2016 - Asynchronous Prorgamming in PHP
Zend con 2016 - Asynchronous Prorgamming in PHP
 
Preparing code for Php 7 workshop
Preparing code for Php 7 workshopPreparing code for Php 7 workshop
Preparing code for Php 7 workshop
 
Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with php
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
 
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensions
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 

Ähnlich wie Php7 hhvm and co

What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7Codemotion
 
[4developers2016] PHP 7 (Michał Pipa)
[4developers2016] PHP 7 (Michał Pipa)[4developers2016] PHP 7 (Michał Pipa)
[4developers2016] PHP 7 (Michał Pipa)PROIDEA
 
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016Codemotion
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHPNat Weerawan
 
Giới thiệu PHP 7
Giới thiệu PHP 7Giới thiệu PHP 7
Giới thiệu PHP 7ZendVN
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPwahidullah mudaser
 
Php mysql training-in-mumbai
Php mysql training-in-mumbaiPhp mysql training-in-mumbai
Php mysql training-in-mumbaivibrantuser
 
Php 7 compliance workshop singapore
Php 7 compliance workshop singaporePhp 7 compliance workshop singapore
Php 7 compliance workshop singaporeDamien Seguy
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy CodeRowan Merewood
 
CodePolitan Webinar: The Rise of PHP
CodePolitan Webinar: The Rise of PHPCodePolitan Webinar: The Rise of PHP
CodePolitan Webinar: The Rise of PHPSteeven Salim
 
PHP: The easiest language to learn.
PHP: The easiest language to learn.PHP: The easiest language to learn.
PHP: The easiest language to learn.Binny V A
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHPBradley Holt
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
 

Ähnlich wie Php7 hhvm and co (20)

What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7
 
[4developers2016] PHP 7 (Michał Pipa)
[4developers2016] PHP 7 (Michał Pipa)[4developers2016] PHP 7 (Michał Pipa)
[4developers2016] PHP 7 (Michał Pipa)
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new with PHP7
 
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
 
The new features of PHP 7
The new features of PHP 7The new features of PHP 7
The new features of PHP 7
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHP
 
Giới thiệu PHP 7
Giới thiệu PHP 7Giới thiệu PHP 7
Giới thiệu PHP 7
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Php mysql training-in-mumbai
Php mysql training-in-mumbaiPhp mysql training-in-mumbai
Php mysql training-in-mumbai
 
Php 7 compliance workshop singapore
Php 7 compliance workshop singaporePhp 7 compliance workshop singapore
Php 7 compliance workshop singapore
 
Wt unit 4 server side technology-2
Wt unit 4 server side technology-2Wt unit 4 server side technology-2
Wt unit 4 server side technology-2
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
CodePolitan Webinar: The Rise of PHP
CodePolitan Webinar: The Rise of PHPCodePolitan Webinar: The Rise of PHP
CodePolitan Webinar: The Rise of PHP
 
PHP: The easiest language to learn.
PHP: The easiest language to learn.PHP: The easiest language to learn.
PHP: The easiest language to learn.
 
Peek at PHP 7
Peek at PHP 7Peek at PHP 7
Peek at PHP 7
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 

Mehr von Pierre Joye

Php 7.x 8.0 and hhvm and
Php 7.x 8.0 and hhvm and Php 7.x 8.0 and hhvm and
Php 7.x 8.0 and hhvm and Pierre Joye
 
Extending php (7), the basics
Extending php (7), the basicsExtending php (7), the basics
Extending php (7), the basicsPierre Joye
 
Php core. get rid of bugs and contribute
Php core. get rid of bugs and contributePhp core. get rid of bugs and contribute
Php core. get rid of bugs and contributePierre Joye
 
Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Pierre Joye
 
Short Intro talk to IPC/Berlin 2012
Short Intro talk to IPC/Berlin 2012Short Intro talk to IPC/Berlin 2012
Short Intro talk to IPC/Berlin 2012Pierre Joye
 
Intro ipcberlin2012
Intro ipcberlin2012Intro ipcberlin2012
Intro ipcberlin2012Pierre Joye
 
Webdevcon pierrejoye-php54-and-other
Webdevcon pierrejoye-php54-and-otherWebdevcon pierrejoye-php54-and-other
Webdevcon pierrejoye-php54-and-otherPierre Joye
 
Php symfony and software lifecycle
Php symfony and software lifecyclePhp symfony and software lifecycle
Php symfony and software lifecyclePierre Joye
 
Mongodb - drupal dev days
Mongodb - drupal dev daysMongodb - drupal dev days
Mongodb - drupal dev daysPierre Joye
 
Webplatform And Php
Webplatform And PhpWebplatform And Php
Webplatform And PhpPierre Joye
 
Keynote, PHP World Kongress Munich
Keynote, PHP World Kongress MunichKeynote, PHP World Kongress Munich
Keynote, PHP World Kongress MunichPierre Joye
 
Php On Windows Internals
Php On Windows InternalsPhp On Windows Internals
Php On Windows InternalsPierre Joye
 
PHP Worl Kongress Munich
PHP Worl Kongress MunichPHP Worl Kongress Munich
PHP Worl Kongress MunichPierre Joye
 
Developing PHP internals on Windows
Developing PHP internals on WindowsDeveloping PHP internals on Windows
Developing PHP internals on WindowsPierre Joye
 

Mehr von Pierre Joye (17)

Php 7.x 8.0 and hhvm and
Php 7.x 8.0 and hhvm and Php 7.x 8.0 and hhvm and
Php 7.x 8.0 and hhvm and
 
Extending php (7), the basics
Extending php (7), the basicsExtending php (7), the basics
Extending php (7), the basics
 
Php core. get rid of bugs and contribute
Php core. get rid of bugs and contributePhp core. get rid of bugs and contribute
Php core. get rid of bugs and contribute
 
Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18Webdevcon Keynote hh-2012-09-18
Webdevcon Keynote hh-2012-09-18
 
Devcon hh-2012
Devcon hh-2012Devcon hh-2012
Devcon hh-2012
 
Short Intro talk to IPC/Berlin 2012
Short Intro talk to IPC/Berlin 2012Short Intro talk to IPC/Berlin 2012
Short Intro talk to IPC/Berlin 2012
 
Intro ipcberlin2012
Intro ipcberlin2012Intro ipcberlin2012
Intro ipcberlin2012
 
Webdevcon pierrejoye-php54-and-other
Webdevcon pierrejoye-php54-and-otherWebdevcon pierrejoye-php54-and-other
Webdevcon pierrejoye-php54-and-other
 
Php symfony and software lifecycle
Php symfony and software lifecyclePhp symfony and software lifecycle
Php symfony and software lifecycle
 
Mongodb - drupal dev days
Mongodb - drupal dev daysMongodb - drupal dev days
Mongodb - drupal dev days
 
Webplatform And Php
Webplatform And PhpWebplatform And Php
Webplatform And Php
 
Keynote, PHP World Kongress Munich
Keynote, PHP World Kongress MunichKeynote, PHP World Kongress Munich
Keynote, PHP World Kongress Munich
 
Php On Windows
Php On WindowsPhp On Windows
Php On Windows
 
Php On Windows Internals
Php On Windows InternalsPhp On Windows Internals
Php On Windows Internals
 
Test Fest 2009
Test Fest 2009Test Fest 2009
Test Fest 2009
 
PHP Worl Kongress Munich
PHP Worl Kongress MunichPHP Worl Kongress Munich
PHP Worl Kongress Munich
 
Developing PHP internals on Windows
Developing PHP internals on WindowsDeveloping PHP internals on Windows
Developing PHP internals on Windows
 

Kürzlich hochgeladen

Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024Stephen Perrenod
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPTiSEO AI
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 

Kürzlich hochgeladen (20)

Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 

Php7 hhvm and co

  • 1. PHP 7, HHVM & CO #PHPKonf Istanbul Pierre Joye
  • 2. 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. PHP7, hhvm & co Stats
  • 4. PHP7, hhvm & co Awesome new extension installer https://github.com/FriendsOfPHP/pickle
  • 5. PHP7, hhvm & co What‘s going in the php world? https://wiki.php.net/rfc/isset_ternary
  • 6. PHP7, hhvm & co PHP 5.3 2009 - 2014
  • 7. PHP7, hhvm & co PHP 5.4 and 5.5 Security fixes only
  • 8. PHP7, hhvm & co PHP 5.4 2012 - 2015
  • 9. PHP7, hhvm & co PHP 5.5 2013 - 2016
  • 10. PHP7, hhvm & co PHP 5.6.11 is out!
  • 11. PHP7, hhvm & co 5 + 1 = 7
  • 12. PHP7, hhvm & co 6.6.6
  • 13. PHP7, hhvm & co PHP 7.0.0beta2 yesterday!
  • 14. PHP7, hhvm & co PHP 7.0 – Future is now
  • 15. PHP7, hhvm & co PHP 7.0 – speed++
  • 16. PHP7, hhvm & co LIES, DAMN LIES AND BENCHMARKS
  • 19. PHP7, hhvm & co Features • Rewamped Engine • True 64bit support • Large string and LFS (Large file support) • Consistent variables syntax • Error exception instead of fatal error • Scalar type declarations • Zero cost asserts
  • 20. PHP7, hhvm & co Features • Secure RNG • PHP4 constructors deprecated • JIT enabled PCRE • Removed ext/mysql, ext/ereg and more • New ?? Operator • New JSON parser • Many other features, a lot already target 7.1
  • 21. PHP7, hhvm & co Error exception instead of fatal error
  • 22. PHP7, hhvm & co Error exception https://wiki.php.net/rfc/catchable-call-to-member-of-non-object <?php try { $x = null; var_dump($x->method()); // The exception class name is EngineException // in alpha1 } catch (Error $e) { // pass } echo "Aliven";
  • 23. PHP7, hhvm & co Scalar Type Declarations
  • 24. PHP7, hhvm & co Scalar Type Declarations <?php declare(strict_types = 1); function add(int $a, int $b) : int { return $a + $b; } $x = add(1, 2); // The exception class name TypeException // in alpha1 $y = add(0.1, 0.2); // TypeError exception https://wiki.php.net/rfc/scalar_type_hints_v5
  • 25. PHP7, hhvm & co Null Coalesce Operator (??)
  • 26. 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
  • 27. PHP7, hhvm & co PHP Language Specification https://github.com/php/php-langspec
  • 28. PHP7, hhvm & co Open & Public Specifications Competions++
  • 31. PHP7, hhvm & co (Most) Focus on Speed
  • 33. PHP7, hhvm & co SPEED is NOT SCALE
  • 34. PHP7, hhvm & co SPEED is UX
  • 35. PHP7, hhvm & co Scale is Server Side Architecture (Apps, Ops, Net, …)
  • 36. PHP7, hhvm & co My code sucks.
  • 37. PHP7, hhvm & co Yours too.
  • 38. PHP7, hhvm & co Steroids++
  • 39. PHP7, hhvm & co So?
  • 42. 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) {…
  • 43. 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);
  • 44. PHP7, hhvm & co QB Source: http://php-qb.net/index.php/2-uncategorised/27-comparing-performance-in-qb-with-hhvm See http://benchmarksgame.alioth.debian.org/u32/performance.php?test=spectralnorm or other
  • 45. PHP7, hhvm & co Zephir
  • 46. PHP7, hhvm & co Zephir Optimization & code generation Compilation + optimization Native execution
  • 47. 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; } }
  • 48. PHP7, hhvm & co Zephir <?php $filter = new MyLibraryFilter(); echo $filter>alpha("01he#l.lo?/1");
  • 49. PHP7, hhvm & co PHP Alternative Implementations
  • 50. PHP7, hhvm & co PHP Alternative Implementations • HHVM (native code) • Recki-ct (native code) • Phalanger (.net engine)
  • 52. PHP7, hhvm & co HHVM PHP Cache Parser (AST in 7+) HHVM Opcodes Native Code JIT ~ Cache
  • 54. PHP7, hhvm & co PHP PHP Cache Parser (AST in 7+) OpCodes
  • 55. PHP7, hhvm & co Recki-ct
  • 56. PHP7, hhvm & co Recki-CT PHP Cache Parser (AST in 7+) Recki IR JIT~ Native Code
  • 57. 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
  • 58. 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 0) 3.67800 FAIL 1.00000 4.96699 FAIL
  • 59. PHP7, hhvm & co Resources • http://wiki.php.net/rfc/ • http://zephir-lang.com/ • http://www.slideshare.net/ircmaxell/high- performance-php-phpnw • http://talks.php.net/fluent15#/ • https://github.com/google/recki-ct • http://blog.ircmaxell.com/2014/08/introducing- recki-ct.html • https://github.com/chung- leong/qb/wiki/Introduction
  • 60. PHP7, hhvm & co Resources • https://edit.php.net/ • 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 • https://github.com/php/php- src/blob/master/UPGRADING • https://github.com/php/php- src/blob/master/UPGRADING.INTERNALS
  • 61. PHP7, hhvm & co Resources • http://phpdbg.com/ • http://windows.php.net/qa/ • http://qa.php.net/ • http://ongr.io • http://aka.ms/AzureCodeManiac2015

Hinweis der Redaktion

  1. Optimum value engineering
  2. September 2015
  3. Pomato pap, tomato mom and a small tomato are crossing the road. The tomato pap tells the small tomato – hurry up, catchup. – secret files, not by word citation 
  4. Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  5. Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  6. Scalar types – Andrea Faulds, Anthony Ferrara … CSPRNG – Sammy Kaye Powers
  7. Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  8. Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  9. Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  10. Yes but…. Speed is not scale Most of you have no scaling problem Your code simply sucks (mines too) Changing languages, servers, platforms do not fix scale issues Fix your code, design and architecture Fast PHP is about scale, not speed.
  11. Except Lars‘
  12. Except Lars‘
  13. Function calls poorly implemented
  14. Delivery Man: Morning, Sir, I've got a parrot for Mr "Poy-rot". Hercule Poirot: No no no! Poirot. It is pronounced "Pwa-roe". Delivery Man: I beg your pardon, Governor. I've got a "pwa-roe" for Mr "Poy-rot".