Skip to content

Instantly share code, notes, and snippets.

@ivanionut
Last active September 23, 2018 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanionut/7a3c60d7dc2450f2c1046810df990989 to your computer and use it in GitHub Desktop.
Save ivanionut/7a3c60d7dc2450f2c1046810df990989 to your computer and use it in GitHub Desktop.
<cfscript>
num_iterations = 1*1000*10000;
// for()
for_start_time = getTickCount();
for(i=1; i<=num_iterations; i++);
for_end_time = getTickCount();
for_tot_time = for_end_time - for_start_time;
writeOutput("<br>for(): #for_tot_time#ms<br>");
// cfloop()
cfloop_start_time = getTickCount();
cfloop(from="1", to=num_iterations, index="i");
cfloop_end_time = getTickCount();
cfloop_tot_time = cfloop_end_time - cfloop_start_time;
writeOutput("<br>cfloop(): #cfloop_tot_time#ms<br>");
// increment
increment = for_tot_time / cfloop_tot_time * 100;
writeOutput("<br>Increment #int(increment)#%<br>");
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment