PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

Collecting Garbage: Performance Considerations

Note: This article was originally published at Planet PHP on 13 September 2010.
Planet PHP

Collecting Garbage: Performance Considerations

London, UK Monday, September 13th 2010, 09:23 BST

This is the third (and last) part of three-parts column that was originally published in the June 2009 issues of php|architect.

Part one is here and part two is here.

In the previous two parts of this column we have explored PHP's take on circular referenced variables and a mechanism that allows to clean up this particular problem with reference counted variable tracking. Of course, the implementation of the garbage collection mechanism in PHP 5.3 has some performance impacts. In this third and last part of the column I will cover the performance implications of the addition of this garbage collection mechanism.

We have already mentioned in the previous part that simply collecting the possible roots had a very tiny performance impact, but this is when you compare PHP 5.2 against PHP 5.3. Although the recording of possible roots compared to not recording them at all like in PHP 5.2 is slower, other changes to the PHP runtime in PHP 5.3 prevented this particular performance loss from even showing.

There are two major areas in which performance is effected. The first area is the allegedly reduced memory usage, and the second area are run-time delays when the garbage collection mechanism performs its memory cleanups. We will look at both of those issues.