Adobe ColdFusion 9 is being promoted as having faster object creation performance over ColdFusion 8.
When ColdFusion is compiled into Java classes each component becomes a Java class and each function within your components becomes a Java class. So one component with five functions compiles down to at least six Java class files. Each of these classes has overhead in object creation so the more functions you have in your objects then the slower your ColdFusion object creation will be.
I’ve performed a simple speed comparison creating an object with only an init() function. I am running this on a Dual Core 2.00GHz Win XP laptop (i.e., it’s a fairly basic machine) running the developer versions of CF8 and CF9 Beta with debug turned off.
| Version | Objects Per Second (approx) |
| CF8 | 4,000 |
| CF9 Beta | 25,000 |
So CF9 object creation has a significant performance improvement.
For comparison, I ran a similar test with creating a trivial Java object and was able to create over 400,000 Java objects per second.
When using ColdFusion to learn object oriented programming this performance factor is extremely important to keep in mind. Virtually all object oriented material you read will be assuming that object creation performance is not a significant issue and will encourage the use of many fine grained objects. When developing OO code in ColdFusion we need to be conservative in our use of objects.
Code used for this test:
Object.cfc
<cfcomponent output="false"> <cffunction name="init" output="false"> <cfreturn this> </cffunction> </cfcomponent>
index.cfm
<cfset numObjects = 10000> <cfset start = getTickCount()> <cfloop index="i" from="1" to="#numObjects#"> <cfset createObject("component","Object").init()> </cfloop> <cfset end = getTickCount()> <cfset seconds = (end-start) / 1000> <cfset objectsPerSecond = numObjects / seconds> <cfoutput> Objects: #numObjects#<br/> Seconds: #seconds#<br/> Objects per second: #objectsPerSecond#<br/> </cfoutput>
Ensure debugging is turned off before running the tests.
UPDATE:
Paul Kukiel has performed similar tests on CF8, CF9 and Railo.
UPDATE:
Rupesh Kumar, of the Adobe ColdFusion engineering team, has put written an excellent article with specific details on ColdFusion ORM and CFC Performance.
UPDATE: Jamie Krug has posted comprehensive performance tests on ColdFusion 8/9, Open BlueDragon 1.1 and Railo 3.1.
ColdFusion 9 · Object Creation · Performance

Ben Nadel · July 16, 2009 at 2:38 pm
Awesome! That’s a huge performance increase. Although, you have to wonder with 4,000 per second in CF8, was that really an issue? I am curious how big your CFCs are since each additional method gets compiled down into a class (from what I’m told).
Paul Kukiel · July 16, 2009 at 2:40 pm
Can you post the exact code you used so I can try this in Railo and on the various flavors ( 64bit, 32 bit ect )
Adam Lehman · July 16, 2009 at 3:00 pm
“Each of these classes has overhead in object creation so the more functions you have in your objects then the slower your ColdFusion object creation will be.”
That’s actually a misconception within the community. Compiling to multiple classes isn’t adding significant overhead to CFC creation time. We spent nearly 12 weeks analyzing the different parts of CFC performance and optimized in a number of areas. When we compiled to a single class we lost a bit of backward fucntionality, but didn’t really boost performance much.
It’s also important to note that CFC performance does not negatively effect the performance of ORM in the slightest. In fact, we were able to get CFCs in/out of Hibernate _faster_ than POJOs.
-Adam Lehman
ColdFusion Product Manager
Manithan · July 16, 2009 at 3:30 pm
Hi Guys,
this is really great. i have one question when i was testing the private beta for cfcomponent they did have an attribute called “strict” which will have only properties in the cfcs which is suppose to be really fastest cfc creation they said did they remove that in the public beta. i tested my code it was not breaking but in the documentation it is not there.
here is my code i tested.
Component
strict=’true’
{
property int id;
property string name;
property string style;
}
Kevan Stannard · July 16, 2009 at 3:40 pm
@Ben, @Paul, I’ve added the code used to the end of the post.
@Adam, I haven’t had a chance to look at the ORM performance but if the ORM object creation is not impacted by CF object creation then this is incredible news. I’ll take another look at object creation performance when additional functions are added to a component. I did some testing a while back and found that the number of functions did impact object creation but I’ll take another look and will be happy to be wrong.
Alirio Boquin A · July 16, 2009 at 5:50 pm
Hi there,
When I started using CFC, this one was a big concert because, CF take a lot time building the object with CF 6.x.
Last year I work with a middle size Website using CF 8. I use a design pattern named Singlenton, in the my application.cfc inside the onApplicationStart method I create all my gateways objects. And the result it’s amazing this website has a huge performance. I wait to see it, using Centaur.
Thanks you Kevan
Henry Ho · July 16, 2009 at 7:53 pm
That’s an awesome news! Thanks Adobe for improving CF9 CFC creation performance!
David Lakein · July 16, 2009 at 9:10 pm
Holy cow.
That same code, on my local CF8 dev instance: 328 seconds, 304.7 objects /second
My local CF9 dev instance: 6.8 seconds, 14,747 objs/second.
Both with debug info on, execution times turned off
Kevan Stannard · July 16, 2009 at 9:48 pm
@David, I forgot to mention that I turned off all debugging for the tests – debugging causes the creation of a very large number of string objects behind the scenes.
Rupesh Kumar · July 17, 2009 at 7:20 am
Good to see that you could see the performance improvements we have made in CF9.
I made a post about ColdFusion ORM and CFC performance yesterday here : http://www.rupeshk.org/blog/index.php/2009/07/coldfusion-orm-and-cfc-performance/
Jamie Krug · July 17, 2009 at 3:44 pm
Kevan said:
“Each of these classes has overhead in object creation so the more functions you have in your objects then the slower your ColdFusion object creation will be.”
Adam said:
“That’s actually a misconception within the community. Compiling to multiple classes isn’t adding significant overhead to CFC creation time.”
@Adam: To be clear, I believe Kevan’s statement is perfectly factual. Rupesh Kumar has confirmed this (see comment at http://bit.ly/4n4Zb). I think your point is that Adobe explored the alternative of having CFCs compile to one class, and though there was some improvement it was not significant, and therefore not worth the trade-off of lost backward compatibility. Correct?
I hope to throw together some tests myself to see just what kind of difference we can expect in CFC creation time with medium and large CFCs versus the very simple one used in Kevan’s test above.
Rupesh Kumar · July 17, 2009 at 6:39 pm
Jamie,
I never confirmed what Kevan had mentioned about “UDF compiling to multiple classes” being the reason for slow cfc creation. What Adam actually said is absolutely right. Compiling UDFs into separate classes does not affect the CFC creation performance at all and this is really a misconception in the community. I have mentioned in the my post at (http://www.rupeshk.org/blog/index.php/2009/07/coldfusion-orm-and-cfc-performance) the reason why CFC creation cost increases as you add methods in it.
Jamie Krug · July 17, 2009 at 7:11 pm
@Rupesh,
Sorry, that’s not what I intended. Let me be more explicit. What I wanted to point out is that regardless of the Java implementation of how CFC methods are compiled, the fact remains that more CFC methods increases the CFC creation time/cost.
I didn’t want others to think that Adam’s comment suggested that this in particular was a misconception. The fact still remains that more CFC methods means more CFC creation time. This is the part of Kevan’s statement, which I noted that you confirmed in your post.
Kevan (above): “…the more functions you have in your objects then the slower your ColdFusion object creation will be.”
Rupesh (http://bit.ly/4n4Zb): “As the number of method increases, the time taken in adding the method objects onto cfc object increases and that increases the total object creation cost.”
Jamie Krug · July 21, 2009 at 10:14 pm
Okay, got around to wrapping up some testing… Railo 3.1.0.23 just added a new “Inspect Templates” setting, which I believe closed any gap (if there was one) in CFC creation speed with CF9:
http://bit.ly/iaABJ
Jamie Krug · July 21, 2009 at 10:16 pm
Doh! I hate not knowing how various comment fields are going to treat URLs, HTML, etc. Here’s a link that should actual work here
http://bit.ly/iaABJ