From: Aryeh Gregor Date: Sun, 27 Jul 2008 18:14:59 +0000 (+0000) Subject: Indeed, this is a ResultWrapper object, so we can iterate over it: no ugly while... X-Git-Tag: 1.31.0-rc.0~46348 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=7d0391a0c5d95890d8fb3e1298f3d375db1f94e2;p=lhc%2Fweb%2Fwiklou.git Indeed, this is a ResultWrapper object, so we can iterate over it: no ugly while loops. In fact, we don't even have to bother creating the array. A few quick tests show >100 KB peak memory usage drop even on a quite small RC, a couple dozen items. --- diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 071854f2c7..c8b430aa67 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -96,22 +96,19 @@ class SpecialRecentChanges extends SpecialPage { $rows = array(); $batch = new LinkBatch; $conds = $this->buildMainQueryConds( $opts ); - $res = $this->doMainQuery( $conds, $opts ); - if( $res === false ){ + $rows = $this->doMainQuery( $conds, $opts ); + if( $rows === false ){ $this->doHeader( $opts ); return; } - while( $row = $res->fetchObject() ){ - $rows[] = $row; + foreach( $rows as $row ) { if ( !$feedFormat ) { // User page and talk links $batch->add( NS_USER, $row->rc_user_text ); $batch->add( NS_USER_TALK, $row->rc_user_text ); } - } - $res->free(); if ( $feedFormat ) { list( $feed, $feedObj ) = $this->getFeedObject( $feedFormat ); @@ -120,7 +117,8 @@ class SpecialRecentChanges extends SpecialPage { $batch->execute(); $this->webOutput( $rows, $opts ); } - + + $rows->free(); } /**