- 快召唤伙伴们来围观吧
- 微博 QQ QQ空间 贴吧
- 文档嵌入链接
- 复制
- 微信扫一扫分享
- 已成功复制到剪贴板
PHP7.3 鸟哥 PHPCON2018
简单介绍php7.3
展开查看详情
1 .NEW FEATURES AND PERFORMANCE A BRIEF TO PHP 7.3 Laruence PHP DEVELOPER
2 .SELF INTRODUCTION A PROGRAMER · Author Of Yaf, Yar, Yac, Yaconf, Taint Projects · Maintainer Of Opcache, Msgpack Projects · PHP Core Developer Since 2011 · Zend Consultant Since 2013 · PHP7 Core Developer · Chief Software Architect At Lianjia Since 2015
3 .PHP HISTORY BORN FOR WEB · Created In 1994 By Rasmus Lerdorf 83.5% PHP · 20+ Years Programming Language 13.4% ASP.NET · Most Popular Web Service Program Language 2.3% Java · Php7 Is Released At 3 Dec 2015 1.9% Static files · Latest Version Is PHP7.2.5 0.6% ColdFusion Ruby 0.6% Perl 0.4% JavaScript 0.4% Python 0.2% Erlang 0.1% W3Techs.com,1 April 2018
4 .HEREDOC AND NEWDOC · The Ending Token No Loner Needs To Be The First Strings Of Line · The Ending Token Can Be Indented · The Exact Number Of Spaces/Tabs Used In The Ending Token Will Be Striped function example($arr) { function example($arr) { $out = ""; $out = ""; foreach($arr as $str) { foreach($arr as $str) { $out .= <<<DOC $out .= <<<DOC repeat {$str} repeat {$str} DOC; DOC; } } return $arr; return $arr; } }
5 .TRAILING COMMA IN FUNC CALLS · Allow Trailing Comma In Function And Method Calls · Only One Extra Comma Are Allowed · You Can Not Use This In Function/Method Declarations function func_call($num1, $num2, $num3, $num4) { func_call( return $num1 + $num2 + $num3 + $mum4; $argument1, } $argument2, $argument3, $argument4, );
6 .REFERENCE IN LIST · Items In List Can Be Assigned By Reference $animal = ['dog', 'cat']; $animal = ['dog', 'cat']; list($a, &$b) = $animal; [$a, &$b] = $animal; $b = "monkey"; $b = "monkey"; var_dump($animal); var_dump($animal); //output: //output: //array(2) { //array(2) { // [0]=> // [0]=> // string(3) "dog" // string(3) "dog" // [1]=> // [1]=> // &string(5) "monkey" // &string(5) "monkey" //} //}
7 .HRTIME · Hrtime Is A High-Resolution Monotonic Timer · It Doesn’t Depends On The System Clock $start = hrtime(true); //........... $end = hrtime(true); $elapsed = $end - $start;
8 .HRTIME · Hrtime Is A High-Resolution Monotonic Timer · It Doesn’t Depends On The System Clock $start = hrtime(true); //........... $end = hrtime(true); $elapsed = $end - $start;
9 .MULTIPLY NEW FEATURES & BUGFIX · Add Net_Get_Interfaces() · Instanceof Now Allows Literals As The First Operand · New Flag Json_Throw_On_Error, Json_Encode/Decode Could Throw Exception Instead Warning Now · Added Is_Countable() Function, To Check Whether A Value May Be Passed Tocount() · Multiply New Methods Added In Gmp · Https://Github.Com/Php/Php-Src/Blob/Master/Upgrading
10 .FASTER NEW GC · Composer Gc Performance Problem Resolved · Multiple Bugs Fixed In The Mean Time
11 .FASTER NEW GC · Removed Double Link List, Plain Array Instead · Dynamically Resize-Able Root Buffers · Dynamically Gc Threshold Adjustment · Reduced Gc_Buffer_Root Size From 32 To 8 (X86_64) · 5X Boost Performance In Tests typedef struct _gc_root_buffer { typedef struct _gc_root_buffer { zend_refcounted *ref; zend_refcounted *ref; struct _gc_root_buffer *next; } gc_root_buffer; struct _gc_root_buffer *prev; uint32_t refcount; } gc_root_buffer;
12 .SIMD OPTIMIZATION FRAMEWORK · Runtime Cpu Feature Detection(Sse, Avx) · Zend_Cpu_Support_Sse42 · Cpu Specific Version Runtime Selection (Ifunc/Function Pointer) · Addslashes · 2X+ Performance Improved In Test
13 .BASE64 SIMD OPTIMIZATION · Base64_Encode/Decode Optimized · 3X Performance Improved In Test (Sse42) · Http://Www.Alfredklomp.Com/Programming/Sse-Base64/ $retry = 100; $start = microtime(true); while (--$retry) { $length = (int)(1000/$retry); $str = file_get_contents("/dev/urandom", false, NULL, 0, $length); //echo "String lenght: ", $length, "\n"; $time = microtime(true); for ($i = 0; $i < 1000000; $i++) { base64_encode($str); } $time = microtime(true) - $time; //echo "Used time: ", $time , "s", "\n"; } echo "Total used time: ", microtime(true) - $start, "s\n";
14 .PERFORMANCE EVOLUTION 14 13.424 10.5 7 6.527 5.318 3.762 3.5 3.102 3.045 2.991 1.022 0.921 0.813 0.803 0 PHP-5.0 PHP-5.1 PHP-5.2 PHP-5.3 PHP-5.4 PHP-5.5 PHP-5.6 PHP-7.0 PHP-7.1 PHP-7.2 PHP-7.3 BENCH.PHP
15 .PERFORMANCE EVOLUTION 400 338 330 317 321 300 200 107 110 112 100 82 75 0 0 0 PHP-5.0 PHP-5.1 PHP-5.2 PHP-5.3 PHP-5.4 PHP-5.5 PHP-5.6 PHP-7.0 PHP-7.1 PHP-7.2 PHP-7.3 WORDPRESS HOMEPAGE QPS
16 .PHP 7.3 ROADMAP · Jun 2018, Alpha1 · Jul 2018, Beta · Aug 2018, Rc · Nov 2018, Ga
17 . THANKS PHP: KEEP GETTING FASTER
18 .PHPCON www.phpconchina.com PPT https://github.com/ThinkDevelopers/PHPConChina QQ 34449228 135615537 ThinkInLAMP