>On Wednesday, May 21, 2003, at 15:30 US/Pacific, Sean A Corfield wrote:
>See my other post (on Structs in CFMX - Java) where I timed both:
Sorry, but could you link us to this? Is CFMX-Java a houseoffusion list, 'cos I
couldn't see it in the navigation list.
>[code omitted]
>Running it for 5000 iterations:
>
>isDefined takes 552 ms
>structKeyExists takes 63 ms
Having read this, I hacked my own test:
<p>
<a href="#sket">structKeyExists time</a><br>
<a href="#idt">isDefined time</a><br>
</p>
<cfoutput>
<cfset beginCount = getTickCount()>
<cfloop from="1" to="10000" index="skec">
<cfif structKeyExists(form, "foo") OR structKeyExists(form, "bar")>
<cfif structKeyExists(form, "foo")>#foo#</cfif>
<cfif structKeyExists(form, "bar")>#bar#</cfif>
</cfif>
</cfloop><br><br>
<cfset endCount = getTickCount()>
<cfset totalTime = endCount - beginCount>
<a name="sket">structKeyExists time: #totalTime#ms</a><br>
<a href="##idt">isDefined time</a><br><br>
<cfset beginCount = getTickCount()>
<cfloop from="1" to="10000" index="idc">
<cfif isDefined("form.foo") OR isDefined("form.bar")>
<cfif isDefined("form.foo")>#foo#</cfif>
<cfif isDefined("form.bar")>#bar#</cfif>
</cfif>
</cfloop><br><br>
<cfset endCount = getTickCount()>
<cfset totalTime = endCount - beginCount>
<a name="idt">isDefined time: #totalTime#ms</a><br>
<a href="##sket">structKeyExists Time</a><br><br>
</cfoutput>
<form action="138test.cfm" name="form138" method="post">
Foo: <input type="Text" name="foo" size="22"><br>
Bar: <input type="Text" name="bar" size="22"><br>
<input type="Submit" value=" Submit ">
</form>
For me, isDefined takes 1229ms & structKeyExists takes 1545ms [or 1286/1526, or
1278/1519: isDefined is consistently faster].
Could this be because I'm running ColdFusion 5, not MX? Why would the two versions
produce such drastically different results?
Rich Hims
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
http://www.cfhosting.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4