Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -103,6 +103,7 @@ |
104 | 104 | var $mTplExpandCache; // empty-frame expansion cache |
105 | 105 | var $mTplRedirCache, $mTplDomCache, $mHeadings, $mDoubleUnderscores; |
106 | 106 | var $mExpensiveFunctionCount; // number of expensive parser function calls |
| 107 | + var $mFileCache; |
107 | 108 | |
108 | 109 | # Temporary |
109 | 110 | # These are variables reset at least once per parse regardless of $clearState |
— | — | @@ -229,6 +230,7 @@ |
230 | 231 | $this->mHeadings = array(); |
231 | 232 | $this->mDoubleUnderscores = array(); |
232 | 233 | $this->mExpensiveFunctionCount = 0; |
| 234 | + $this->mFileCache = array(); |
233 | 235 | |
234 | 236 | # Fix cloning |
235 | 237 | if ( isset( $this->mPreprocessor ) && $this->mPreprocessor->parser !== $this ) { |
— | — | @@ -4292,8 +4294,18 @@ |
4293 | 4295 | return $sk->link( $title ); |
4294 | 4296 | } |
4295 | 4297 | |
| 4298 | + # Get the file |
| 4299 | + $imagename = $title->getDBkey(); |
| 4300 | + if ( isset( $this->mFileCache[$imagename][$time] ) ) { |
| 4301 | + $file = $this->mFileCache[$imagename][$time]; |
| 4302 | + } else { |
| 4303 | + $file = wfFindFile( $title, $time ); |
| 4304 | + if ( !(count( $this->mFileCache ) <= 1000) ) { |
| 4305 | + $this->mFileCache = array(); |
| 4306 | + } |
| 4307 | + $this->mFileCache[$imagename][$time] = $file; |
| 4308 | + } |
4296 | 4309 | # Get parameter map |
4297 | | - $file = wfFindFile( $title, $time ); |
4298 | 4310 | $handler = $file ? $file->getHandler() : false; |
4299 | 4311 | |
4300 | 4312 | list( $paramMap, $mwArray ) = $this->getImageParams( $handler ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -165,6 +165,8 @@ |
166 | 166 | * Added the ability to display user edit counts in Special:ListUsers. Off by |
167 | 167 | default, enabled with $wgEdititis = true (named after the medical condition |
168 | 168 | marked by unhealthy obsession with edit counts). |
| 169 | +* Added a file cache to the parser to improve page rendering time on pages with |
| 170 | + several uses of the same image. |
169 | 171 | |
170 | 172 | === Bug fixes in 1.14 === |
171 | 173 | |