php7 new special new

1. Variable Type
parameter php7 version of the function return value and increases the types of defined. Why php define the type to join, in fact, this feature is characteristic for JIT php7.1 version of preparation, increase the type php JIT can accurately determine the variable types, produce the best machine instructions.
Test function (int $ A, $ B String, Array C $): int {
}

2. Error Abnormal
php program error hou past Zend engine will be a fatal error and terminates the program run, php7 can use try / catch to catch the error.
{the try
non_exists_func ();
} the catch (EngineException $ E) {
echo "Exception: E- {$> the getMessage ()} \ n-"
}

3.zval use the stack memory
in the Zend Engine and extension, often want to create a PHP variable, the bottom is a zval pointer. Previous versions are assigned a dynamic MAKE_STD_ZVAL zval memory from the heap through. The PHP7 direct use of stack memory.
PHP5
the zval * Val; MAKE_STD_ZVAL (Val);
PHP7
the zval Val;
[advantage: to save a memory allocation]

4.Zend_string stored hash value, array not need to repeat the query calculated hash
PHP7 string of creating a new type called a separate zend_string, except char * pointer and length, adds a hash field, a hash value of the stored string . Find an array of keys do not need to repeatedly compute the hash value.
_zend_string {struct
zend_refcounted GC;
zend_ulong H;
size_t len;
char Val [. 1]
};

5.hashtable barrel put data directly, reducing the number of application memory, Cache hit rate and improved memory access speed
zend_parse_parameters changed macro implementation, performance improvement of 5%
4 new OPCODE, call_user_function, is_int / string / array, strlen , defined 4 OpCode functions into a command, faster
optimization more other properties, such as basic type int, float, bool value is copied directly to other sorting algorithms improve, PCRE with JIT, execute_data and use the global register opline using gdb4.8 function of PGO

JIT PHP7
php7.0-Final version will not carry the characteristics of JIT
JIT is an acronym just in time, expressed runtime instructions into binary machine code.
For compute-intensive programs, the PHP OpCode JIT can be directly converted into machine code that dramatically improves the performance of
PHP development team has developed plans to restart the JIT, it will be expected to PHP7.1 version with JIT properties

Guess you like

Origin www.cnblogs.com/zhirusi/p/12014173.html