PHP 5.4 Performance
Thanks to Dmitry Stogov
Laruence
@laruence
/
PHP
• 1995
• 77.3%
• 5.4
• 4x
PHP Performance Evaluation
bench.php
PHP 5.0 13
PHP 5.1 6.5
PHP 5.2 5.6
PHP 5.3 3.9
PHP 5.4 3.3
0 2 4 6 8 10 12 14
sec
PHP Performance Evaluation
micro_bench.php
PHP 5.0 57.44
PHP 5.1 31.86
PHP 5.2 28.55
PHP 5.3 22.66
PHP 5.4 12.67
0 10 20 30 40 50 60 70
sec
New freatures
• Traits
• Built-in web server
• Array de-referencing
• Class member access on instantiation
• Shortened array syntax
• Binary number format
• …
• 我们今天只讲5.3到5.4的优化
Delayed Hashtable Allocation
• 很多的HashTable都是空的
• 类的静态属性表, 常量表, 函数表
• 用户定义的空数组
• 推迟对HashTable的Buckets的内存分配, 直到第一个元素被插入
Literal Tables
• 每一条V