Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
안정수
@findstar
내가 아는
Laravel Framework를
소개합니다.PHP7 으로 뛰어들기
안정수
Xpressengine 개발
PHP, Java, Objective-c, react.js
@findstar
발표자 소개
1. PHP7 is coming
2. Performance
3. New features
4. PHP 버전 이야기
5. Migration
목차
1. PHP7 is Coming
PHP 7 Is Coming
Are your Web Application Ready?
1-1. PHP7?
2015. 10월 PHP7이 나옵니다!
(현재 RC1)
PHP5.4
PHP5.5
PHP5.6
PHP6
PHP7
1-2. PHP6는 어디로 갔나요?
PHP6 는 없어요....
1-2. PHP6 망!
Unicode 지원등등..... 진행하다가 GG
1-3. PHP-NG(next generation)
PHP-NG : 원래 별도의 브랜치
=> 7.0 됨
주된 내용은 : PHP 리팩토링!
1-4. PHP7 internal?
Zend engine 3.0
Smaller data structures
Fewer allocations
Less indirection
1-5. ZVAL
PHP5 PHP7
ZVAL 32 bytes 16 bytes
HashTable 72 bytes 56 bytes
object 96 bytes 40 bytes
1-6. Memory management
Less heap, more stack
Redevelop a new heap and optimize
Cpu cache friendly
1-6. XE 에서 체험해보세요.
demo.xpressengine.com
2. Performance
3-1. Benchmark Test
XE1 - Board ab -k -c 50 -n 10000 http://xe1.app/
3-2. Benchmark Env
2012 mid Macbook Pro Retina
Vagrant Rasmus Image
3-3. Benchmark Result
0
30
60
90
120
PHP 5.4 PHP 5.5 PHP 5.6 PHP 7.0
-1.66% 2.21% 40.11%
Request / Sec
80.6 79.2 80.9
113....
3-5. 공식 Benchmark 4.4 ~ 7.0
짧은게 좋은겁니다..
0.8 PHP 7.0
참고 링크
3-6.WP - XE
0
30
60
90
120
PHP 5.6 PHP 7.0
WP 4.2.4
XE WP 4.2.4
XE
40.11%
102.4%
Requests / Sec
3-7. Local Composer
composer create-project laravel/laravel
php 5.6 : Memory usage: 160.27MB (peak: 222.83MB)
php 7.0 : Me...
3-8.Wordpress
워드 프레스 사이트가 php7 으로 구동환경을 바꾸었더니
CPU 자원 사용율이 72% 감소함
3-9. 결론
PHP7 = php5.6
PHP7 = php5.0
X 2
X 14
Speeeeeeeeeeeeed UP!
참고 링크
3. New features in PHP7
PHP7
3-1. Scalar type
function add(int $a, int $b) {
return $a + $b
}
echo add(1, 2); // 3
echo add(1.2, 2); // 3
3-1. Scalar type
declare(strict_types=1);
function add(int $a, int $b) {
return $a + $b
}
echo add(1, 2); // 3
echo add(1....
3-2. Return type
function add(int $a, int $b) : int {
return $a + $b
}
echo add(1, 2);
3-3. Spaceship operator
echo 2 <=> 2; // 0
echo 2 <=> 3; // -1
echo 2 <=> 1; // 0
3-3. Spaceship operator
function compareValue($a, $b){
return ($a < $b ) ? -1 : ( ($a > $b ) ? 1 : 0 );
}
function compare...
3-4. Engine Exceptions
BaseException abstract
EngineException
ParseException
Exception
ErrorException
RuntimeException
fat...
3-4. Engine Exceptions
class A {
public function t(){
return 't called';
}
}
$testa = new A();
echo $testa->aaa();
3-5. Group namespace
use BarLibBarFoo{
ClassA,
ClassB,
ClassC,
ClassD as FooFoo
};
3-6. Null Coalesce Operator
$username = isset($a)? $a :‘foo’;
$username = $a?? ‘foo’;
3-7. Closure::call
class Foo{
public $bar;
}
$foo = new Foo;
$foo->bar = 10;
$clo = function($a) {
print_r($this->bar + $a...
3-8.Anonymous class
var_dump(new class(){});
object(class@anonymous)#1 (0) {
}
3-9. Non static method call
class A{
function foo() { var_dump($this); }
}
class B{
function bar(){ A::foo(); }
}
$b = new...
4.Version of PHP
4-1 PHP 버전 지원
5.3 5.4
4-2 PHP 5.3 …..
4-3 지금 PHP 5.3, 5.4 쓰시나요?
4-4 하늘이 무너져도..
4-4 배포판의 보안 지원
CentOS 5.x php 5.3 2017 년 3월
CentOS 6.x php 5.3 2020년 11월
CentOS 7.x php 5.4 2024년 6월
Ubuntu 10.04 LTS php ...
4-5 요약
5.3 과 5.4 를 사용중이시라면
버전을 올리시는게 좋습니다.
5. Migration
MISSION MIGRATION
5-1. Migration
in PHP 7 Doctrines..
- Do not fall into a “Python2VS Python3” war
버전이 올라가도 하위 호한성을 유지합니다.
5-2. Removed
ereg
mssql
mysql
sybase_ct
aolserver, apache,
apache_hooks, apache2filter,
caudium, continuity
isapi, milter, ...
5-3. Removed
<% %>
<%=
<script language=php>
</script>
<? 와 <?= 는 없어지지 않습니다.
5-3. Removed
call_user_method()
call_user_method_array()
call_user_func()
call_user_func_array()
5-4. Deprecated
5-5. Migration
http://php.net/manual/en/migration70.php
5-6. Migration Assistant Report
https://github.com/Alexia/php7mar
끝
새로운 모습의 PHP7을 기대해 봅니다
참고
[php7]
http://php.net/manual/en/migration70.php
http://devzone.zend.com/4693/php-7-glance/
[slideshare]
http://www.slid...
Upcoming SlideShare
Loading in …5
×

Introduce php7

2,122 views

Published on

php7 introduce on xpressengine cms team open seminar.

Published in: Technology
  • Be the first to comment

Introduce php7

  1. 1. 안정수 @findstar 내가 아는 Laravel Framework를 소개합니다.PHP7 으로 뛰어들기
  2. 2. 안정수 Xpressengine 개발 PHP, Java, Objective-c, react.js @findstar 발표자 소개
  3. 3. 1. PHP7 is coming 2. Performance 3. New features 4. PHP 버전 이야기 5. Migration 목차
  4. 4. 1. PHP7 is Coming PHP 7 Is Coming Are your Web Application Ready?
  5. 5. 1-1. PHP7? 2015. 10월 PHP7이 나옵니다! (현재 RC1)
  6. 6. PHP5.4 PHP5.5 PHP5.6 PHP6 PHP7 1-2. PHP6는 어디로 갔나요? PHP6 는 없어요....
  7. 7. 1-2. PHP6 망! Unicode 지원등등..... 진행하다가 GG
  8. 8. 1-3. PHP-NG(next generation) PHP-NG : 원래 별도의 브랜치 => 7.0 됨 주된 내용은 : PHP 리팩토링!
  9. 9. 1-4. PHP7 internal? Zend engine 3.0 Smaller data structures Fewer allocations Less indirection
  10. 10. 1-5. ZVAL PHP5 PHP7 ZVAL 32 bytes 16 bytes HashTable 72 bytes 56 bytes object 96 bytes 40 bytes
  11. 11. 1-6. Memory management Less heap, more stack Redevelop a new heap and optimize Cpu cache friendly
  12. 12. 1-6. XE 에서 체험해보세요. demo.xpressengine.com
  13. 13. 2. Performance
  14. 14. 3-1. Benchmark Test XE1 - Board ab -k -c 50 -n 10000 http://xe1.app/
  15. 15. 3-2. Benchmark Env 2012 mid Macbook Pro Retina Vagrant Rasmus Image
  16. 16. 3-3. Benchmark Result 0 30 60 90 120 PHP 5.4 PHP 5.5 PHP 5.6 PHP 7.0 -1.66% 2.21% 40.11% Request / Sec 80.6 79.2 80.9 113.34 XE - 게시판 목록 benchmark
  17. 17. 3-5. 공식 Benchmark 4.4 ~ 7.0 짧은게 좋은겁니다.. 0.8 PHP 7.0 참고 링크
  18. 18. 3-6.WP - XE 0 30 60 90 120 PHP 5.6 PHP 7.0 WP 4.2.4 XE WP 4.2.4 XE 40.11% 102.4% Requests / Sec
  19. 19. 3-7. Local Composer composer create-project laravel/laravel php 5.6 : Memory usage: 160.27MB (peak: 222.83MB) php 7.0 : Memory usage: 121.91MB (peak: 170.53MB) 23.42% 감소
  20. 20. 3-8.Wordpress 워드 프레스 사이트가 php7 으로 구동환경을 바꾸었더니 CPU 자원 사용율이 72% 감소함
  21. 21. 3-9. 결론 PHP7 = php5.6 PHP7 = php5.0 X 2 X 14 Speeeeeeeeeeeeed UP! 참고 링크
  22. 22. 3. New features in PHP7 PHP7
  23. 23. 3-1. Scalar type function add(int $a, int $b) { return $a + $b } echo add(1, 2); // 3 echo add(1.2, 2); // 3
  24. 24. 3-1. Scalar type declare(strict_types=1); function add(int $a, int $b) { return $a + $b } echo add(1, 2); // 3 echo add(1.2, 2); // TypeException
  25. 25. 3-2. Return type function add(int $a, int $b) : int { return $a + $b } echo add(1, 2);
  26. 26. 3-3. Spaceship operator echo 2 <=> 2; // 0 echo 2 <=> 3; // -1 echo 2 <=> 1; // 0
  27. 27. 3-3. Spaceship operator function compareValue($a, $b){ return ($a < $b ) ? -1 : ( ($a > $b ) ? 1 : 0 ); } function compareValue2($a, $b){ return $a <=> $b; }
  28. 28. 3-4. Engine Exceptions BaseException abstract EngineException ParseException Exception ErrorException RuntimeException fatals 대신 Exception
  29. 29. 3-4. Engine Exceptions class A { public function t(){ return 't called'; } } $testa = new A(); echo $testa->aaa();
  30. 30. 3-5. Group namespace use BarLibBarFoo{ ClassA, ClassB, ClassC, ClassD as FooFoo };
  31. 31. 3-6. Null Coalesce Operator $username = isset($a)? $a :‘foo’; $username = $a?? ‘foo’;
  32. 32. 3-7. Closure::call class Foo{ public $bar; } $foo = new Foo; $foo->bar = 10; $clo = function($a) { print_r($this->bar + $a ); }; $clo->call($foo, 10);
  33. 33. 3-8.Anonymous class var_dump(new class(){}); object(class@anonymous)#1 (0) { }
  34. 34. 3-9. Non static method call class A{ function foo() { var_dump($this); } } class B{ function bar(){ A::foo(); } } $b = new B; $b->bar();
  35. 35. 4.Version of PHP
  36. 36. 4-1 PHP 버전 지원 5.3 5.4
  37. 37. 4-2 PHP 5.3 …..
  38. 38. 4-3 지금 PHP 5.3, 5.4 쓰시나요?
  39. 39. 4-4 하늘이 무너져도..
  40. 40. 4-4 배포판의 보안 지원 CentOS 5.x php 5.3 2017 년 3월 CentOS 6.x php 5.3 2020년 11월 CentOS 7.x php 5.4 2024년 6월 Ubuntu 10.04 LTS php 5.3 , 지원중단. Ubuntu 12.04 LTS php 5.3 2017년 4월 Ubuntu 14.04 LTS php 5.5.9
  41. 41. 4-5 요약 5.3 과 5.4 를 사용중이시라면 버전을 올리시는게 좋습니다.
  42. 42. 5. Migration MISSION MIGRATION
  43. 43. 5-1. Migration in PHP 7 Doctrines.. - Do not fall into a “Python2VS Python3” war 버전이 올라가도 하위 호한성을 유지합니다.
  44. 44. 5-2. Removed ereg mssql mysql sybase_ct aolserver, apache, apache_hooks, apache2filter, caudium, continuity isapi, milter, nsapi, phttpd, pi3web, roxen, thttpd, tux, webjames Extensions SAPI
  45. 45. 5-3. Removed <% %> <%= <script language=php> </script> <? 와 <?= 는 없어지지 않습니다.
  46. 46. 5-3. Removed call_user_method() call_user_method_array() call_user_func() call_user_func_array()
  47. 47. 5-4. Deprecated
  48. 48. 5-5. Migration http://php.net/manual/en/migration70.php
  49. 49. 5-6. Migration Assistant Report https://github.com/Alexia/php7mar
  50. 50. 끝 새로운 모습의 PHP7을 기대해 봅니다
  51. 51. 참고 [php7] http://php.net/manual/en/migration70.php http://devzone.zend.com/4693/php-7-glance/ [slideshare] http://www.slideshare.net/zymsys/new-in-php-7?related=2 http://www.slideshare.net/jpauli/php7-is-coming?next_slideshow=1 [php internal] https://nikic.github.io/2015/05/05/Internal-value-representation-in-PHP-7-part-1.html https://nikic.github.io/2015/06/19/Internal-value-representation-in-PHP-7-part-2.html http://nikic.github.io/2014/12/22/PHPs-new-hashtable-implementation.html [migration assistant report] https://github.com/Alexia/php7mar

×