SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

PDF
Key features PHP 5.3 - 5.6
Federico Damián Lozada Mosto
 
ODP
The why and how of moving to PHP 5.4/5.5
Wim Godden
 
ODP
Php in 2013 (Web-5 2013 conference)
julien pauli
 
PPTX
Php internal architecture
Elizabeth Smith
 
PDF
How to inspect a RUNNING perl process
Masaaki HIROSE
 
PPTX
Php7 HHVM and co
weltling
 
PPTX
Modern Perl for the Unfrozen Paleolithic Perl Programmer
John Anderson
 
ODP
The why and how of moving to PHP 5.5/5.6
Wim Godden
 
PDF
How to deploy node to production
Sean Hess
 
PPT
Hacking with hhvm
Elizabeth Smith
 
ODP
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
 
PPTX
PSGI and Plack from first principles
Perl Careers
 
PDF
Zend con 2016 - Asynchronous Prorgamming in PHP
Adam Englander
 
PDF
Preparing code for Php 7 workshop
Damien Seguy
 
PPTX
Socket programming with php
Elizabeth Smith
 
KEY
Kansai.pm 10周年記念 Plack/PSGI 入門
lestrrat
 
PDF
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
ODP
The why and how of moving to php 5.4/5.5
Wim Godden
 
PPTX
Zephir - A Wind of Change for writing PHP extensions
Mark Baker
 
PDF
Pycon - Python for ethical hackers
Mohammad Reza Kamalifard
 
Key features PHP 5.3 - 5.6
Federico Damián Lozada Mosto
 
The why and how of moving to PHP 5.4/5.5
Wim Godden
 
Php in 2013 (Web-5 2013 conference)
julien pauli
 
Php internal architecture
Elizabeth Smith
 
How to inspect a RUNNING perl process
Masaaki HIROSE
 
Php7 HHVM and co
weltling
 
Modern Perl for the Unfrozen Paleolithic Perl Programmer
John Anderson
 
The why and how of moving to PHP 5.5/5.6
Wim Godden
 
How to deploy node to production
Sean Hess
 
Hacking with hhvm
Elizabeth Smith
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
 
PSGI and Plack from first principles
Perl Careers
 
Zend con 2016 - Asynchronous Prorgamming in PHP
Adam Englander
 
Preparing code for Php 7 workshop
Damien Seguy
 
Socket programming with php
Elizabeth Smith
 
Kansai.pm 10周年記念 Plack/PSGI 入門
lestrrat
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
The why and how of moving to php 5.4/5.5
Wim Godden
 
Zephir - A Wind of Change for writing PHP extensions
Mark Baker
 
Pycon - Python for ethical hackers
Mohammad Reza Kamalifard
 

Similar to Php7 hhvm and co (20)

PDF
What To Expect From PHP7
Codemotion
 
PPTX
Peek at PHP 7
John Coggeshall
 
PDF
[4developers2016] PHP 7 (Michał Pipa)
PROIDEA
 
PPTX
Php 7.x 8.0 and hhvm and
Pierre Joye
 
PDF
The new features of PHP 7
Zend by Rogue Wave Software
 
PDF
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
Codemotion
 
PPTX
New in php 7
Vic Metcalfe
 
PDF
PHP7 is coming
julien pauli
 
PDF
Php7 傳說中的第七隻大象
bobo52310
 
PDF
Start using PHP 7
Oscar Merida
 
PDF
Last Month in PHP - June through Mid-July 2017
Eric Poe
 
PDF
Giới thiệu PHP 7
ZendVN
 
PDF
Php 7 compliance workshop singapore
Damien Seguy
 
PPTX
Migrating to PHP 7
John Coggeshall
 
PPTX
PHP7 Presentation
David Sanchez
 
PDF
What's new in PHP 7.1
Simon Jones
 
PDF
Preparing for the next php version
Damien Seguy
 
PDF
HHVM and Hack: A quick introduction
Kuan Yen Heng
 
PPTX
From PHP to Hack as a Stack and Back
Timothy Chandler
 
PPTX
Php extensions
Elizabeth Smith
 
What To Expect From PHP7
Codemotion
 
Peek at PHP 7
John Coggeshall
 
[4developers2016] PHP 7 (Michał Pipa)
PROIDEA
 
Php 7.x 8.0 and hhvm and
Pierre Joye
 
The new features of PHP 7
Zend by Rogue Wave Software
 
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
Codemotion
 
New in php 7
Vic Metcalfe
 
PHP7 is coming
julien pauli
 
Php7 傳說中的第七隻大象
bobo52310
 
Start using PHP 7
Oscar Merida
 
Last Month in PHP - June through Mid-July 2017
Eric Poe
 
Giới thiệu PHP 7
ZendVN
 
Php 7 compliance workshop singapore
Damien Seguy
 
Migrating to PHP 7
John Coggeshall
 
PHP7 Presentation
David Sanchez
 
What's new in PHP 7.1
Simon Jones
 
Preparing for the next php version
Damien Seguy
 
HHVM and Hack: A quick introduction
Kuan Yen Heng
 
From PHP to Hack as a Stack and Back
Timothy Chandler
 
Php extensions
Elizabeth Smith
 
Ad

More from Pierre Joye (16)

PPTX
Extending php (7), the basics
Pierre Joye
 
PPTX
Php core. get rid of bugs and contribute
Pierre Joye
 
PPTX
Webdevcon Keynote hh-2012-09-18
Pierre Joye
 
PPTX
Devcon hh-2012
Pierre Joye
 
PPTX
Short Intro talk to IPC/Berlin 2012
Pierre Joye
 
PPTX
Intro ipcberlin2012
Pierre Joye
 
PPTX
Webdevcon pierrejoye-php54-and-other
Pierre Joye
 
PPTX
Php symfony and software lifecycle
Pierre Joye
 
PPTX
Mongodb - drupal dev days
Pierre Joye
 
PPTX
Webplatform And Php
Pierre Joye
 
PPTX
Keynote, PHP World Kongress Munich
Pierre Joye
 
PPTX
Php On Windows
Pierre Joye
 
PPTX
Php On Windows Internals
Pierre Joye
 
PPTX
Test Fest 2009
Pierre Joye
 
PPT
PHP Worl Kongress Munich
Pierre Joye
 
PPT
Developing PHP internals on Windows
Pierre Joye
 
Extending php (7), the basics
Pierre Joye
 
Php core. get rid of bugs and contribute
Pierre Joye
 
Webdevcon Keynote hh-2012-09-18
Pierre Joye
 
Devcon hh-2012
Pierre Joye
 
Short Intro talk to IPC/Berlin 2012
Pierre Joye
 
Intro ipcberlin2012
Pierre Joye
 
Webdevcon pierrejoye-php54-and-other
Pierre Joye
 
Php symfony and software lifecycle
Pierre Joye
 
Mongodb - drupal dev days
Pierre Joye
 
Webplatform And Php
Pierre Joye
 
Keynote, PHP World Kongress Munich
Pierre Joye
 
Php On Windows
Pierre Joye
 
Php On Windows Internals
Pierre Joye
 
Test Fest 2009
Pierre Joye
 
PHP Worl Kongress Munich
Pierre Joye
 
Developing PHP internals on Windows
Pierre Joye
 
Ad

Recently uploaded (20)

PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Digital Circuits, important subject in CS
contactparinay1
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 

Php7 hhvm and co

  • 1. PHP 7, HHVM & CO #PHPKonf Istanbul Pierre Joye
  • 2. PHP7, hhvm & co Pierre Joye @pierrejoye [email protected] 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

Editor's Notes

  • #8: Optimum value engineering
  • #9: September 2015
  • #11: 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 
  • #15: Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  • #16: Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  • #20: Scalar types – Andrea Faulds, Anthony Ferrara … CSPRNG – Sammy Kaye Powers
  • #22: Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  • #24: Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  • #26: Fall 2015 Stabilization RFCs in discussions More optimizatons coming
  • #33: 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.
  • #38: Except Lars‘
  • #40: Except Lars‘
  • #45: Function calls poorly implemented
  • #50: 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".