ColdFusion 8 performance timing

Posted At : July 2, 2008 11:33 AM | Posted By : Dave
Related Categories: ColdFusion 8

I was reading a post on the cftalk list about interesting timing numbers via cf script and cfset. Read it here.

The post referenced a blog entry from Neil Middleton that published the timing numbers for doing some set statements via cf7, cf8, and bd.net. I noticed when reading the blog that the numbers posted were based on cf8 beta and not the release version. So, I decided to redo the tests posted and see how they differ from the post. Here is what I found...

Below is the code and the reported time from Neil's blog (CF8beta) and the result from my test (CF8.01). I did my test the same as his. Multiple runs, and reported the average times. The tests were ran on a WIN2003 Enterprise server (Quad 3.0 xeon / 2gb ram)

<cfloop from="1" to="10000" index="i">
<cfset foo = createObject("component","foo")>
</cfloop>
CF8 BetaCF8.01
2100ms547ms

<cfloop from="1" to="10000" index="i">
<cfparam name="myName" default="dave">
</cfloop>
CF8 BetaCF8.01
16ms5ms

<cfloop from="1" to="1000000" index="i">
<cfset foo = "poo">
</cfloop>
CF8 BetaCF8.01
31ms36ms

<cfloop from="1" to="100000" index="i">
<cfset foo = arrayNew(1)>
<cfset arrayAppend(foo, "This is an item")>
</cfloop>
CF8 BetaCF8.01
1500ms39ms
<cfloop from="1" to="100000" index="i">
<cfset foo = structNew()>
<cfset foo.poo = "1">
</cfloop>
CF8 BetaCF8.01
1266ms52ms

<cfscript>
for (i=1;i lte 100000;i=i+1)
{
foo = structNew();
foo.poo = "1";
}
</cfscript>

CF8 BetaCF8.01
78ms60ms

So there you have it. It would appear that cf8.01 is even faster than the beta. However, the differences between 8 beta and 8.01 could be slanted due to machine performance differences.

--DAve

Comments
Dave,

Neil's tests were done on "Windows Vista and IIS7 on my laptop", but your tests were done on "WIN2003 Enterprise server (Quad 3.0 xeon / 2gb ram)". That's like comparing how fast I can run with some *beta* Nike shoes vs. a world-class sprinter wearing the same Nike shoes (but post-release). The shoes may be nearly the same, but the hardware (me=some sluggish Vista laptop vs. sprinter=Quad Xeon) is vastly different; so, I'm sorry to say that sounds like a completely invalid test comparison.

A "better" test would be to run CF 8 (beta) on the same machine where your CF 8.01 install resides.

btw - can you modify your blog software to allow plus (+) signs in email addresses: http://cfzen.instantspot.com/blog/2008/04/30/Does-...
# Posted By Aaron Longnion | 7/2/08 1:03 PM
These test don't make sense. I just rewritten your tests to Java (last and third from bottom). Here they are. Last one:
   public static void main(String[] args)
   {
      long start = System.currentTimeMillis();
      for (int i=1; i <= 100000; i++)
      {
         Hashtable&lt;String, String&gt; foo = new Hashtable&lt;String, String&gt;();
         foo.put("poo", "1");
      }
      System.out.println("Test : " + (System.currentTimeMillis() - start));
   }

my result is: from 18 to 21 ms.
Third from bottom:

   public static void main(String[] args) {
      long start = System.currentTimeMillis();
      for (int i=1; i <= 100000; i++)
      {
         ArrayList&lt;String&gt; foo = new ArrayList&lt;String&gt;();
         foo.add("This is an item");
      }
      System.out.println("Test : " + (System.currentTimeMillis() - start));
   }

result is: from 8 to 16ms.
Where is rest of that time gone?
But as I said - these tests don't make sense :)
# Posted By radekg | 7/2/08 2:33 PM
Remember that CF treats all variables as dynamic so the loop index is being coerced to numeric each time around (amongst other differences between Java and CFML).
# Posted By Sean Corfield | 7/2/08 4:39 PM
@radekg My intention was not to say if the tests made sense or not. My intent was to just put out more current data than the data I found.

@Aaron I totally agree with you. My results is a total apples to oranges comparison. I would totally agree that some of the speed increase is due to the server. I also feel that if you are going to post performance data it should not be from tests on a notebook.


--Dave
# Posted By Dave Ferguson | 7/2/08 6:57 PM
@Aaron Forgot to mention... I put in the modification to allow plus sign email addresses.

--Dave
# Posted By Dave Ferguson | 7/2/08 6:58 PM
Of course Sean. It keeps all simple variables (dates, booleans, numbers, ...) as strings and tests them before executing expression.
# Posted By radekg | 7/3/08 2:37 AM