title: ColdFusion 2016 performance versus ColdFusion 9
body: <p>We are in the process of upgrading from ColdFusion 9 to ColdFusion 2016 and we have noticed an overall decrease of performance. We ran several simulations to give more insight. Below is a script that gives a good example of the performance decrease. The script builds a query and then creates a structure from the query.</p>
  
  <pre><code>&lt;!--- Machine info ---&gt;
  &lt;cfset runtime = createObject("java", "java.lang.System")&gt;
  &lt;cfset props = runtime.getProperties()&gt; 
  &lt;cfset env = runtime.getenv()&gt; 
  
  &lt;Cfoutput&gt;
  
  coldfusion: #SERVER.ColdFusion.ProductVersion# #SERVER.ColdFusion.ProductLevel#&lt;br&gt;
  
  java.version: #props["java.version"]#&lt;br&gt;
  java.vm.name: #props["java.vm.name"]#&lt;br&gt;
  os.name: #props["os.name"]#&lt;br&gt;
  
  PROCESSOR_IDENTIFIER: #env["PROCESSOR_IDENTIFIER"]#&lt;br&gt;
  PROCESSOR_ARCHITECTURE: #env["PROCESSOR_ARCHITECTURE"]#&lt;br&gt;
  NUMBER_OF_PROCESSORS: #env["NUMBER_OF_PROCESSORS"]#&lt;br&gt;&lt;Br&gt;
  &lt;/Cfoutput&gt;
  
  &lt;!--- Create a query ---&gt;
  &lt;cfset myQuery = QueryNew("Name, Time, Advanced", "VarChar, Time, Bit")&gt; 
  &lt;cfset testQuery = QueryNew("ColumnA,ColumnB,ColumnC,ColumnD,ColumnE,ColumnF,ColumnG,ColumnH,ColumnI,ColumnJ,ColumnK,ColumnL,ColumnM,ColumnN","VarChar,VarChar,VarChar,VarChar,VarChar,VarChar,VarChar,VarChar,VarChar,VarChar,VarChar,VarChar,VarChar,VarChar")&gt;
  
  &lt;!--- Populate the query ---&gt;
  &lt;Cfloop from=1 to=300 index="x"&gt;
      &lt;cfset QueryAddRow(testQuery, 1)&gt; 
      &lt;cfloop index="intLetter" from="#Asc('A')#" to="#Asc('N')#" step="1"&gt;
          &lt;cfset temp = QuerySetCell(testQuery, "Column#chr(intLetter)#", "Row #x# column #intLetter#", x)&gt; 
      &lt;/cfloop&gt;
  &lt;/cfloop&gt;
  
  &lt;Cfset init = GetTickCount()&gt;
  &lt;!--- Query to structure ---&gt;
  &lt;Cfset queryToStruct = structNEw()&gt;
  &lt;cfloop query="testQuery"&gt;
  &lt;Cfset init2 = GetTickCount()&gt;
      &lt;cfset queryToStruct[testQuery.currentrow] = structNew()&gt;
      &lt;cfset queryToStruct[testQuery.currentrow]['ColumnA'] = structNew()&gt;
      &lt;cfloop list="#testQuery.columnList#" index="key"&gt;
          &lt;cfset queryToStruct[testQuery.currentrow]['ColumnA'][testQuery[key][testQuery.currentrow]] = testQuery[key][testQuery.currentrow]&gt;
      &lt;/cfloop&gt;
      &lt;cfoutput&gt;#x#:#GetTickCount()-init2#&lt;br&gt;&lt;/cfoutput&gt;
  &lt;/cfloop&gt;
  
  &lt;cfoutput&gt;-----------&lt;br&gt;&lt;b&gt;#GetTickCount()-init#&lt;/b&gt;&lt;br&gt;&lt;br&gt;&lt;Br&gt;&lt;/cfoutput&gt;
  
  &lt;!---Cfdump var=#queryToStruct# ---&gt;
  </code></pre>
  
  <p>We have two servers with the exact same hardware configuration. One server is running on Windows 2008 / ColdFusion Server 9 Enterprise (Java version 1.6.0_14) and the other one is running on Windows 2016 / ColdFusion 2016 Standard (Java version 1.8.0_112). Both ColdFusion servers have the same Minimum JVM Heap Size (5024 MB) and Maximum JVM Heap Size (5048 MB). </p>
  
  <p>The performance on the ColdFusion 9 server is more then 4x faster. Can someone give an explanation of why this is happening and how to solve this?</p>
  
  <p><strong>Update</strong></p>
  
  <p>To rule out any other process that would slow down ColdFusion I installed ColdFusion 9, ColdFusion 11 and ColdFusion 2016 all on the same virtual machine and all using the built in web server. Default installation settings. The outcome: ColdFusion 9 is fastest, followed closely by ColdFusion 11. ColdFusion 2016 is much slower.</p>
  
  <p><strong>Update 2</strong>
  Made some changes to the script, so it is more clear what this script is doing.</p>
  
  <p><strong>Update 3</strong>
  The results can be viewed here:
  <a href="http://136.144.177.152/test2.asp" rel="nofollow noreferrer">http://136.144.177.152/test2.asp</a> or
  <a href="http://136.144.177.152/test-toma.asp" rel="nofollow noreferrer">http://136.144.177.152/test-toma.asp</a> or 
  <a href="http://136.144.177.152/test-ag.asp" rel="nofollow noreferrer">http://136.144.177.152/test-ag.asp</a>
  Note that the code is actually processed, so each time you load the page the results differ slightly.</p>
  
  <p>Also i would like to point out i am not trying to optimize this code.  I tried to make a very simple reproducible example. The sole purpose is to point out the difference in performance and find a reason and a solution.</p>
  
  <p><strong>Update 4</strong>
  Did some extra testing and found the potential problem. For some reason the following code is very slow on coldfusion 2016 / Windows 2016 :</p>
  
  <pre><code>&lt;cfset tmp = testQuery['ColumnA'][testQuery.currentrow]&gt;
  </code></pre>
  
  <p>What i found very strange is that updating the query value is not slow. E.g.</p>
  
  <pre><code>&lt;cfset testQuery['ColumnA'][testQuery.currentrow] = key&gt;
  </code></pre>
  
  <p>All results can be found here: <a href="http://136.144.177.152/test5.asp" rel="nofollow noreferrer">http://136.144.177.152/test5.asp</a> or <a href="http://136.144.177.152/test6.asp" rel="nofollow noreferrer">http://136.144.177.152/test6.asp</a>. I also installed coldfusion 2016 on my laptop and found no performance issues. I also tried installing coldfusion 2016 on windows 2012 machine. Here i found the same performance issues.</p>
  
  <p><strong>Update 5</strong>
  Based on Tomalak suggestion I removed the indexed access notation. This clearly is a performance issue on coldfusion 2016. Actual results can be found here <a href="http://136.144.177.152/bug-adobe.asp" rel="nofollow noreferrer">http://136.144.177.152/bug-adobe.asp</a>. I opened a bug at adobe for this issue here <a href="https://tracker.adobe.com/#/view/CF-4201966" rel="nofollow noreferrer">https://tracker.adobe.com/#/view/CF-4201966</a>.</p>