Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30793 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60676 invoked by uid 1010); 11 Jul 2007 21:35:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 60661 invoked from network); 11 Jul 2007 21:35:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Jul 2007 21:35:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=chris#@codewarehouse.NET; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=chris#@codewarehouse.NET; sender-id=unknown Received-SPF: error (pb1.pair.com: domain codewarehouse.NET from 75.160.109.235 cause and error) X-PHP-List-Original-Sender: chris#@codewarehouse.NET X-Host-Fingerprint: 75.160.109.235 hitme.hitometer.net Received: from [75.160.109.235] ([75.160.109.235:61134] helo=hitme.hitOmeter.NET) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/B3-06860-F2D45964 for ; Wed, 11 Jul 2007 17:35:44 -0400 Received: from hitme.hitOmeter.NET (localhost.hitOmeter.NET [127.0.0.1]) by hitme.hitOmeter.NET (8.13.8/8.13.8) with ESMTP id l6BLZYes062670 for ; Wed, 11 Jul 2007 14:35:40 -0700 (PDT) (envelope-from chris#@codewarehouse.NET) Received: (from www@localhost) by hitme.hitOmeter.NET (8.13.8/8.13.8/Submit) id l6BLZY7b062669; Wed, 11 Jul 2007 14:35:34 -0700 (PDT) (envelope-from chris#@codewarehouse.NET) To: internals@lists.php.net MIME-Version: 1.0 Date: Wed, 11 Jul 2007 14:35:34 -0700 In-Reply-To: References: Message-ID: X-Sender: chris#@codewarehouse.NET User-Agent: hitOmeter-mail/0.01 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Mid-term Update for Cycle Collector (Google Summer of Code Project) From: chris#@codewarehouse.NET (chris#) On Wed, 11 Jul 2007 13:43:19 -0700, "David Wang" wrote: > Hello, everyone. My name is David Wang and I am one of the students > participating in Google Summer of Code this year. As you may remember, > my project is to implement a garbage collector for circular references > in PHP. As the midterm for Summer of Code is coming up, my mentor, > Derick Rethans, thought it would be a good idea if I shared my > progress with the community. > > As you know, PHP uses reference counting as a simple garbage > collection system. One of the primary weaknesses of reference counting > systems is that objects that refer indirectly or directly to > themselves, i.e. reference cycles, are not collected. The accumulation > of unreferenced memory that is only deallocated at the end of a > request can be prohibitively expensive. The cycle collector I am > implementing directly addresses this problem. > > The cycle collector is, of necessity, a type of tracing garbage > collector. However, it uses reference count information to accelerate > the collection process. Essentially, it works by removing the internal > reference counts (that is, references from an object within the cycle > to another object within the cycles )from candidate cycles. In a cycle > that can be collected, after all internal reference counts have been > removed, the reference count of all objects within the cycle should be > 0. The particular algorithm that I am using is the synchronous cycle > collector described by David Bacon and V. T. Rajan in Concurrent Cycle > Collection in Reference Counted Systems (see the article for further > details). Various optimizations allow the cycle collector to be run > relatively infrequently and execute speedily when it does run. > > Note that because PHP is designed to be single-threaded, a synchronous > algorithm is used which does pause program execution for cycle > collection when cycle collection becomes necessary. If a program has > no reference cycles, the cycle collector does not run at all. > > The initial phase of implementation is complete, and I am currently > profiling, optimizing and trying the modified version of PHP on > various test programs in an effort to find bugs. Meanwhile, here are > some recent benchmarks. > > Some aspects of the eZ Components (http://ez.no/ezcomponents, > available from SVN with the instructions here: > http://ez.no/community/articles/an_introduction_to_ez_components/installation) > testing suite use reference cycles heavily. The Template test uses > circular references the most frequently, the Graph test also uses > circular references, albeit less heavily. > > On the Graph test, maximum memory usage with unmodified PHP was 133.9 > MB with an execution time of 8 seconds. > On the Graph test, maximum memory usage with gc was 51.6 MB with an > execution time of 9 seconds. > On the Template test, maxmium memory usage with unmodified PHP was 1.5 > GB with an execution time of 30 seconds. > On the Template test, maxmium memory usage with gc was 67.3 MB with an > execution time of 1 minute. > On the whole suite of tests (which includes the Graph and Template > tests), execution time with unmodified PHP was 12:03. With cycle > collection, it was 12:43. > These tests were conducted on my dual core AMD X2 4400+ desktop with > ./configure --with-gd --with-jpeg-dir --with-zlib. As you can see, > there is the classic time vs. memory trade-off. > > My project is currently being hosted on the xdebug CVS. You can get > the latest version with the following commands: > > cvs -d :pserver:srmread@cvs.xdebug.org:/repository login > CVS password: srmread > cvs -d :pserver:srmread@cvs.xdebug.org:/repository co circular > Note that I'm implementing my project on top of a CVS version of PHP > 5.2 that is a couple of weeks old. However, the cycle collector can be > ported into other versions of PHP fairly easily as it does not affect > the existing Zend engine code too much. > > If anyone has any questions, I'll be more than happy to answer them! > > Regards, > > Yiduo (David) Wang KUDOS! > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php ///////////////////////////////////////////////////// Service provided by hitOmeter.NET internet messaging! .