createUUID speeded up in ColdFusion 9

At CFUNITED, Hemant (Engineering Manager for ColdFusion) mentioned that createUUID was speed up in ColdFusion 9. CreateUUID isn’t the fastest function in the world, and has some possible scary implications in some scenarios (see this excellent blog post by Tyson Vanek) but I’ve made use of it for years now in my open source applications because of how easy it is to use across multiple database platforms. I decided to take a look at the speed changes and I was pretty impressed by what I found. So my test case was relatively simple, and to be honest, I am not a big fan of ‘loop and time’ type tests, but I figured it would be a quick way to check. Here is what I used.

<cfsetting showdebugoutput="true"> <cftimer label="createUUID() test" type="inline"> <cfloop index="x" from="1" to="20000"> <cfset createUUID()> </cfloop> </cftimer>

Running under ColdFusion 8, this takes a little over 20 seconds - which meshes exactly with what Tyson mentioned in his blog post. Running the exact same code in ColdFusion 9? A bit over 2 seconds. A 10 fold increase in speed. Of course, I don’t think anyone will need to create twenty thousand UUIDs at once anytime soon, but that’s a pretty nifty speed increase. It’s the difference between the Enterprise NX-01 and 1701!

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments