title: Coldfusion/Railo: What's the most efficient way to output file contents - fileRead or include?
body: <p>While I've always cached database calls and placed commonly used data into memory for faster access, I've been finding of late that simple processing and output of data can add a significant amount of time to page load and thus I've been working on a template caching component that will save parsed HTML to either a file, or in memory, for quicker inclusion on pages.</p>
  
  <p>This is all working very well, reducing some page loads down to 10% of the uncached equivalent - however I find myself wondering what would be the most efficient way to output the content.</p>
  
  <p>Currently I'm using <code>fileRead</code> to pull in the parsed HTML and save to a variable, which is output on the page.
  This seems very fast, but I'm noticing the memory used by the Tomcat service gradually increasing - presumably because the <code>fileRead</code> operation is reading the contents into memory, and quite possibly, Tomcat isn't removing that data when its finished. </p>
  
  <p><em>(Side question: Anyone know a way that I can interrogate the JVM memory and find details/stack traces of the objects that CF has created??)</em></p>
  
  <p>Alternatively, I could use <code>cfinclude</code> to simply include the parsed HTML file. From all the information I can find it seems that the speed would be about the same - so would this method be more memory efficient?
  I've had issues on the server before with memory usage crashing Tomcat, so keeping it down is quite important.</p>
  
  <p>Is there anyone doing something similar that can give me the benefit of their experience?</p>