Created
July 11, 2012 17:36
-
-
Save isapir/3091917 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfsetting requesttimeout="300"> | |
<cfparam name="nIterations" default="5"> | |
<cfparam name="nMultiple" default="1"> | |
<cfset iTarget = 10000000 * nMultiple> | |
<cfdump eval="nIterations"> | |
<cfdump eval="nMultiple"> | |
<cfdump eval="iTarget"> | |
<style> | |
div.fl { float: left; margin: 2em; padding: 1em; } | |
</style> | |
<div> | |
<div class="fl"> | |
<div>original loop</div> | |
<cfscript> | |
for(k=1;k lte nIterations; k++) { | |
iLoopTime = getTickCount(); | |
loop from="1" to="#iTarget#" index="i" {} | |
iLoopTime = getTickCount() - iLoopTime; writeDump(iLoopTime); flush; | |
} | |
</cfscript> | |
</div> | |
<div class="fl"> | |
<div>structDelete()</div> | |
<cfscript> | |
for(k=1;k lte nIterations; k++) { | |
iLoopTime = getTickCount(); | |
loop from="1" to="#iTarget#" index="i" {} | |
iLoopTime = getTickCount() - iLoopTime; writeDump(iLoopTime); flush; | |
structDelete(variables, "i"); | |
} | |
</cfscript> | |
</div> | |
<div class="fl"> | |
<div>set i = 0</div> | |
<cfscript> | |
for(k=1;k lte nIterations; k++) { | |
i = 0; | |
iLoopTime = getTickCount(); | |
loop from="1" to="#iTarget#" index="i" {} | |
iLoopTime = getTickCount() - iLoopTime; writeDump(iLoopTime); flush; | |
} | |
</cfscript> | |
</div> | |
<div class="fl"> | |
<div>index="variables.i"</div> | |
<cfscript> | |
for(k=1;k lte nIterations; k++) { | |
iLoopTime = getTickCount(); | |
loop from="1" to="#iTarget#" index="variables.i" {} | |
iLoopTime = getTickCount() - iLoopTime; writeDump(iLoopTime); flush; | |
} | |
</cfscript> | |
</div> | |
<div class="fl"> | |
<div>to="#variables.iTarget#" index="variables.i"</div> | |
<cfscript> | |
for(k=1;k lte nIterations; k++) { | |
iLoopTime = getTickCount(); | |
loop from="1" to="#variables.iTarget#" index="variables.i" {} | |
iLoopTime = getTickCount() - iLoopTime; writeDump(iLoopTime); flush; | |
} | |
</cfscript> | |
</div> | |
</div> | |
<br style="clear:both;"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment