As we mentioned in the previous section, recycling may have a slight performance impact, but it is only available when PHP5.2 and PHP5.3 are compared. Although in PHP5.2, the root of the record may be slower than the root of the non-record at all, other modifications to PHPrun-time in PHP5.3 reduce this performance loss. As we mentioned in the previous section, recycling may have a slight performance impact, but it is only available when comparing PHP 5.2 with PHP 5.3. Although in PHP 5.2, the root of the record may be slower than the root of the non-record, other modifications to PHP run-time in PHP 5.3 reduce this performance loss.
There are two main fields that affect the performance. The first is the space savings in memory usage, and the other is the increase in execution time (run-time delay) when the garbage collection mechanism cleans up memory ). We will study these two fields.
Memory space savings
First, the whole reason for implementing the garbage collection mechanism is to save memory usage by clearing the variables referenced by the loop once the prerequisites are met. In PHP execution, once the root buffer is full or the gc_collect_cycles () function is called, garbage collection is executed. In, it shows the memory usage of the following scripts in PHP 5.2 and PHP 5.3 respectively, excluding the basic memory occupied by PHP when the script is started.
Example #1 Example of memory usage
self = $a; if ( $i % 500 === 0 ) { echo sprintf( '%8d: ', $i ), memory_get_usage() - $baseMemory, "\n"; } } ?>
The above is the garbage collection mechanism of PHP features 3-performance considerations. For more information, see PHP Chinese website (www.php1.cn )!