Last modified: 2008-10-10 22:24:19 UTC
Created attachment 5411 [details] $mFileCache patch Currently if a page contains more than one use of the same image, the parser will call wfFindFile() once for each instance of the image regardless of whether or not its loaded it before. On most pages this isn't an issue, but on pages that make heavy use of an image (or images) such as in a template it can significantly slow down loading time to repeatedly reload the same image. The attached patch adds a file cache for the parser, caching each file object if it gets loaded more than once (to avoid caching every image on the page, suggested by Brion).
Why not go ahead and create a global file cache while you're at it?
A global cache might need additional management for images being created or deleted during a long-running process, and wouldn't have its memory freed when a single-user parser is discarded.
Added in r41952 after some more input from Brion and Tim on IRC (limit size to 1000, resets after reaching 1000).