I have heard the question a lot "Should I enable the Save Class Files option in the ColdFusion MX 6.1 Administrator". Well the answer is, it depends!! If you enable save class files ColdFusion will not need to recompile the files across restarts, instead it will load the class file from disk. This can be both good and bad. I willl attempt to explain.
If you have a lot of CFM files or a lot of ColdFusion applications that add up to a lot of Class files you may end up with thousands of class files in cfclasses. The problem is when ColdFusion restarts it searches through the /cfclasses directory to find the class that is needed to load. If it does not find it, then it will compile the .cfm file and save the class file to disk. This adds up to a lot of file IO along with a search through the file listing to find the class file. Both of these procedures add up to a lot of time as the number of files in /cfclasses increases. With thousands of class files this may take 500+ ms to occur or even longer. It only increases as the number of files increases.
Saving class files to disk gained you a lot more with CFMX 6.0 because of the compiler that was used. It used javac or jikes to compile and was really slow. The new 6.1 compiler converts the CFM files directly from CFML to bytecode and if you have a speedy processor it happens in 100-200ms and loads the class into memory. Load tests have shown this to be faster with large numbers of class files in /cfclasses.
So, the choice for this setting depends on the number of cfm templates you have. The only way to find out is to test which option performs best in your situaion.
Good to know. I've been recommending folks do not enable Save Class Files and getting mostly puzzled stares in return. Now I can point them at your blog for an answer!
Those puzzled stares probably stem from the bit of text right below the check box:
"Macromedia recommends this for production systems."
So we have 7,968 files in the cfclasses folder. I assume from your post then, in my case you would recommend that I do NOT save the class files--is that correct? Is there any way to test this before/after to show the speed difference?
Thanks for your insightful posts!
I found 10,045 class files in the folder, so I assumed I was a candidate for not saving. Set CF Admin to not save and, sure enough, I can't see any difference in performance on my dual Piii-800 1.5gb box.
Thx for the tip!