Popular recipes by Neil Hodgson http://code.activestate.com/recipes/users/98096/2001-03-31T22:42:56-08:00ActiveState Code RecipesCache file contents to speed access (Python) 2001-03-31T22:42:56-08:00Neil Hodgsonhttp://code.activestate.com/recipes/users/98096/http://code.activestate.com/recipes/52300-cache-file-contents-to-speed-access/ <p style="color: grey"> Python recipe 52300 by <a href="/recipes/users/98096/">Neil Hodgson</a> (<a href="/recipes/tags/files/">files</a>). </p> <p>Some tasks require reading from a set of files in a random manner. Opening and reading files is a time consuming operation even when the operating system is caching the contents of the files in memory. Caching files explicitly can speed up processing greatly especially where the cached form is optimised for likely access patterns.</p>