Php 7.x 8.0 and hhvm and
-
Upload
pierre-joye -
Category
Engineering
-
view
79 -
download
0
Transcript of Php 7.x 8.0 and hhvm and
PHP 7, 8 ,HHVM & CO
OCTOBER 13, 2016PHP Conference ManilaPierre Joye
Pierre Joye@[email protected]://www.slideshare.net/pierrej
PHP Core developerOSS dev
Portability fan
hiring@BKK
dev – devops - sysops
stats
contribute.
https://edit.php.net
What‘s new in PHP worlds?
Awesome new extension installer
https://github.com/FriendsOfPHP/pickle
RFCshttps://wiki.php.net/
rfc
Release Process RFChttps://wiki.php.net/rfc/
releaseprocess
Lifecycle
PHP 5.32009 - 2014
PHP 5.42012 - 2015
PHP 5.52013 - 2016
January 2017: security fixes onlyPHP 5.6
5.6.26
5 + 1 = 7
6.6.6
7.0.11
7.1Future is now
7.0 - speed++
lies, damned lies & benchmarks
PHP 7.0FEATURES
■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
■Secure RNG■PHP4 constructors deprecated■JIT enabled PCRE■Removed ext/mysql, ext/ereg and more■New ?? and spaceship operators■New JSON parser■Many other features, a lot already target
7.1
PHP 7.1FEATURES
■Multiple Exception types catch■Http/2 Push support■Class constant visibility■Improved return types (void and more)■Allow custom keys for list(“foo“, “bar“)■Warning about invalid strings in arithmetic ops■Many more features
OPEN & PUBLIC SPECIFICATIONS
COMPETIONS++
FOCUS ON SPEED (MOST)
SPEED IS NOT SCALE
STEROID++
What is scale?
SO?
<?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) {…
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);
QB
Source: http://php-qb.net/index.php/2-uncategorised/27-comparing-performance-in-qb-with-hhvmSee http://benchmarksgame.alioth.debian.org/u32/performance.php?test=spectralnorm or other
ZEPHIR
Optimization & code generation
Compilation + optimization
Native execution
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; }}
<?php $filter = new MyLibrary\Filter();echo $filter>alpha("01he#l.lo?/1");
PHP8
https://github.com/zendtech/php-src/tree/jit-dynasm/ext/opcache/jit
20% speedup on bench.php
PHP Alternative Implementations
Tagua VMRust based PHP Implemetation
https://github.com/tagua-vm/tagua-vm
Future
■Extend PHP using php (à la hhvm)■Go, Rust, .net extensions
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
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
Resources
■ http://phpdbg.com/■ http://windows.php.net/qa/■ http://qa.php.net/■ http://ongr.io■ http://aka.ms/AzureCodeManiac2015