Content from a bug report I recently submitted to Adobe related to expandPath() in ColdFusion 10. They have acknowledged it is a bug and will be fixing it. https://bugbase.adobe.com/index.cfm?event=bug&id=3198902
We have two identical versions of our application running on the same server – one in CF9 and one in CF10. We noticed that CF10 is signficantly slower. To be more specific it is more that 10x slower than CF9. So, we started experimenting with CFTIMER to narrow down the issue. Here's what we discovered…
<cfset expandpath('/') />
On ColdFusion 9, this runs in 10-20ms on average. In ColdFusion 10, it runs in 200-250ms on average.
We use expandpath quite a bit in our applications. So, pages that load in less than 200ms on CF9 are now loading in 10000+ milliseconds on CF10.
It doesn't matter if we change it to this…
<cfset expandpath('/some/folder/path') />
The result is still the same.
Note that our application does run from a UNC path because it is load balanced across multiple servers. So, the expand path will resolve to \\server\folder\file.cfm. As you can see, this works just fine with CF9 but CF10 can't seem to handle it.
Steps to Reproduce:
Set up a site with a UNC path as the root. Create a simple CFM file with an expandPath('/') in it. Look at the time taken. We are on Windows 2008 with IIS.
Any Workarounds: If you put a mapping of “/” to your root directory in the cf admin it works MUCH faster. But by doing this, you can't have multiple sites running off one CF instance.
Addtional test/code in ColdFusion 10:
<cffile action=”read” file=”\\myserver\myweb\www\robots.txt” variable=”tester” />
(Hard Coded \\\myserver\myweb\www\robots.txt cffile read): 7ms
<cffile action=”read” file=”#expandpath('/robots.txt')#” variable=”tester” />
(Expand Path expandpath('/robots.txt') cffile read): 229ms
<cfinclude template= “/robots.txt” />
(cfinclude /robots.txt): 4ms
5 Replies to “ExpandPath() in ColdFusion 10 Slow”
Did you report this as a bug to Adobe?
@heiko – https://bugbase.adobe.com/index.cfm?event=bug&id=3198902
Just curious, but have you tried creating a drive mapping to the UNC and use that instead?
This seems like it’s probably an issue w/the UNC pathing, so maybe the use of a mapped drive will resolve the issue.
@Dan – We did try this, but using a mapped drive does not work well with IIS.
According to Adobe, this has been fixed in build 282570. Hopefully that will be released with in a hotfix or update soon. Seems like it will also a good opportunity to try out the new built-in updater in CF10.