Comparing Component speed on different CFML engines

Posted At : November 27, 2006 10:54 AM | Posted By : Mark Drew
Related Categories: coldfusion

After my previous couple of posts of comparing different speeds for instantiating structures vs components, I thought I would measure the same process on different Coldfusion engines.

I set up a small test that basically logs speeds to a database (for easy charting mainly) and I measure just the time of the inner loop (the creation of X number of objects). Now, this is not a scientific test and you should take the stats with a pinch of salt, they were run on my MacBook Pro (not exactly a server machine is it) and I tried to make everything as equal as possible (turning on the Trusted Cache for both Adobe ColdFusion and New Atlanta's BlueDragon, I wasn't able to spot something similar in Railo) and run the cycle a few times before setteling on the figure I was going to use (so the code could 'bed in').

The code that I am running on these tests is basically the same as before, but I am posting it here for comparison:

Object Speed Test<cfflush>
      <cfloop from="0" to="2000" index="x" step="50">
      .<cfflush>

         <cfset tStartStruct = GetTickCount()>
         <cfloop from="1" to="#x#" index="i">
            <cfset stItem = StructNew()>
            <cfset stItem.name = "Bob" & i>
            <cfset stItem.age = 20>
         </cfloop>
         <cfset tTotalStruct = GetTickCount() - tStartStruct>

         <cfset tStartComponent= GetTickCount()>      
         <cfloop from="1" to="#x#" index="i">
            <cfset oItem = CreateObject('component', 'Person')>
            <cfset oItem.setname("Bob" & i )>
            <cfset oItem.setage(20)>
         </cfloop>
         <cfset tTotalComponent = GetTickCount() - tStartComponent>

            <cfquery name="logThis" datasource="reporting">
                  UPDATE reports
                  SET bdStruct = #tTotalStruct#,
                  bdComponent = #tTotalComponent#         
                  WHERE Instances = #x#
            </cfquery>
      |<cfflush>
      </cfloop>
      done!

I can post the precise results if people want but the charts kind of speak for themselves. Anything I missed?


EDIT: The versions of the engines are:

Adobe ColdFusion 7.02

New Atlanta Bluedragon Server JX 6.2.1.9

Railo (Live) 1.0.0.027

All these are the versions that run on OS X by the way

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Tony Petruzzi's Gravatar What version of BD did you use? The Java or BD.Net? If you didn't do this test with BD.Net, please do. I have a feeling that BD.Net would be the winner in this case.
# Posted By Tony Petruzzi | 11/27/06 1:01 PM
Andy Jarrett's Gravatar Interesting to see Railo doing well - not in a bad sense more in a shocked sense. Im presuming CFMX was version 7.02, though what Railo version where you using?
# Posted By Andy Jarrett | 11/27/06 1:17 PM
Mark Drew's Gravatar I should have mentioned the versions, I have updated the post. With regards of running the .NET version of BD, well, I am doing this on a Mac so cant run the windows only installer. Besides, if the .net verison is built on the .NET framework, its kind of unfair to compare it to two other engines that are running in the JVM isnt it? Unless they do a .net port of ColdFusion and Railo?
# Posted By Mark Drew | 11/27/06 2:01 PM
Sean's Gravatar The results are not very conclusive. I know the test setup has plenty of holes, but I am commenting on the results. All 3 results are linear, so they basically have the same performance, if the slope of one of the lines increased, then it would be an important difference.
# Posted By Sean | 11/27/06 2:21 PM
Mark Drew's Gravatar Not sure if I agree with you there, the tests are linear as its the amount of time to create X amount of objects.

In theory they *SHOULD* be linear, since I am testing how long it takes to create 50,100,150 etc objects. so it should take roughly twice the time to create 2000 objects than it takes to create 1000 objects . Would you expect exponential curves or something else?
# Posted By Mark Drew | 11/27/06 2:31 PM
Tony Petruzzi's Gravatar @Mark

Totally missed the fact that you were doing this on a MAC. However the reason I ask is because I would like to see if .Net handles this better then Java. It would be interesting.
# Posted By Tony Petruzzi | 11/27/06 3:01 PM
Mark Drew's Gravatar Tony, I am not sure if it would matter, I am testing components to see how each engine renders down its component (to a java class or a .net class) and copes with it. This post is to see if you really *should* be making several thousand components and if there are better ways of doing it.
# Posted By Mark Drew | 11/27/06 3:10 PM
Dan Wilson's Gravatar I wonder what Vince B. will say to this test?
# Posted By Dan Wilson | 11/27/06 3:28 PM
Gert Franz's Gravatar You can use the trusted setting for each defined mapping. So you could in fact turn it on for one mapping and off for another mapping. Just click the related checkbox in the Railo Web Administrator.
I have to mention, that even "/" is a mapping. It is defined in the server administrator and points to the web's root. But in order to make the "/" mapping trusted just define it in your local web accordingly by pointing it to your root directory.
# Posted By Gert Franz | 11/27/06 3:39 PM
Mark Drew's Gravatar I didnt mean to be controversial, I just tested the engines with the same test... so dont want to ruffle feathers...

*sitting on the fence*
# Posted By Mark Drew | 11/27/06 3:40 PM
Mark Drew's Gravatar Gert, Railo was running so fast I didnt need to do it :)
# Posted By Mark Drew | 11/27/06 3:41 PM
Vince Bonfanti's Gravatar As others (Charlie Arehart? Dave Watts?) have pointed out in the past (sorry, I don't have any links handy), these sort of "loop 10,000 times" micro-benchmarks are not really meaningful and have little or no relation to performance you're going to see in real-world applications. A real-world test should be done on real applications with a load-testing tool that can simulate multiple simultaneous clients, and that measures end-to-end response times.
# Posted By Vince Bonfanti | 11/27/06 4:52 PM
Vince Bonfanti's Gravatar I should add: nevertheless, we'll take a look at Mark's tests. I suspect that what he thinks he's measuring (the time it take to create components) isn't really what he's measuring, and that the graphs are reflecting something else entirely.
# Posted By Vince Bonfanti | 11/27/06 4:55 PM
Gert Franz's Gravatar Well I just wanted to mention it, that there are still things you can do to improve performance:
- Disable Scope cascading (Admin/Settings)
- Convert the mapping into a railo archive (Admin/Mappings)
- enable trusted cache per mappings ((Admin/Mappings))
- upgrade to Railo 1.1
# Posted By Gert Franz | 11/27/06 4:58 PM
Mark Drew's Gravatar Vince, I agree with you, this is a micro test done by a non-tester (i.e. I am not testing a real world application, the number of objects created is obscene and I am not doing proper clean up) Not sure WHAT else I could be reflecting though, please let me know and I shall amend the test, I was just trying to see if (as with previous posts of comparing oranges to apples) there was a marked difference creating objects (or rather components) on the different CFML engines out there.

The whole point of this post is to show people that randomly creating objects (that for example, could be held in a recordset) simply because Java does it isnt the best idea in the world.

Besides, as I have also mentioned I am doing this test on a laptop, a MAC laptop, which would never be used as a server.

(Also was using java version 1.4.2 by default if that matters)
# Posted By Mark Drew | 11/27/06 5:04 PM
Mark Drew's Gravatar I am just wondering Gert/Vince (might be a really dumb question, so excuse me) can I deploy either BD or Railo as a EAR or WAR? (they re pretty easily installed by themselves I should add, and the startup times are pretty trivial)
# Posted By Mark Drew | 11/27/06 5:07 PM
Reuben's Gravatar What was the J2EE engine you were using for Railo, CFMX and BD? Were all three run on Jrun, or was it CFMX+Jrun, BD standalone, and Railo+resin?
# Posted By Reuben | 11/27/06 5:48 PM
Mark Drew's Gravatar JRUN+ CF
BD standalone
and Railo-live (the download on their site, just run from the command line)
# Posted By Mark Drew | 11/27/06 5:54 PM
Vince Bonfanti's Gravatar Hi Mark,

If you really want to dig into this, the first thing you need to do is run the test with "empty" CFLOOP tags; it could be that the performance difference is due to running tens of thousands of CFLOOP iterations (which would be unusual in a "normal" CFML page). Then you'll want to run with only the CFSETs that contain the StructNew and CreateObject function calls; it could be that the other CFSETs are actually taking longer than these, espcially the one that contains the string concatenation.

However, if you really want to do a CFML engine comparison that has "real world" applicability, the thing to do is create a CFML page that contains a "normal" number of CreateObject calls (maybe 20 or so? maybe one of the Mach II sample applications?) and then run a load tester on it and compare requests/second, overall response times, and CPU and memory usage during the tests. Only then will you get meaningful data that reasonably translates to the results you'd expect in the real world.
# Posted By Vince Bonfanti | 11/27/06 7:41 PM
Gert Franz's Gravatar Hi Mark,
in fact you can even download the WAR of Railo in order to deploy it. Just as a normal JEE application place it into the webapps folder and restart the server. It should install automatically.
# Posted By Gert Franz | 11/27/06 7:50 PM
Vince Bonfanti's Gravatar Dan Wilson wrote: "I wonder what Vince B. will say to this test?"

Here it is (it addition to the comments I made here previously):

http://blog.newatlanta.com/index.cfm?mode=entry&am...
# Posted By Vince Bonfanti | 12/13/06 12:04 AM
Mark Drew's Gravatar Vince, is there a limitation for creating (java) objects on BD for J2EE developer edition? I think I might have it installed wrong?
# Posted By Mark Drew | 12/13/06 8:20 AM
Vince Bonfanti's Gravatar No, there's no limitation for creating Java object in the BD/J2EE developer edition.
# Posted By Vince Bonfanti | 12/13/06 5:36 PM