Last active
November 18, 2022 19:54
-
-
Save JamoCA/1e9b424d0f4f401984ae60d127d96215 to your computer and use it in GitHub Desktop.
Comparison of ListFindNoCase versus ListFind w/lcased values or pre-optimized values
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
<!--- 2022118 Comparison of ListFindNoCase versus ListFind w/lcased values or pre-optimized values | |
Tweet: https://twitter.com/gamesover/status/1593692201363521536 | |
----> | |
<cfscript> | |
a = "A,B,c,d,E,f,g,H,I,J,l,m,n,O,p,Q,R,S,t,u,v"; | |
s = "S"; | |
iterations = 1000000; | |
t = gettickcount(); | |
for(i=0; i lte iterations; i+=1){ | |
listfindnocase(a, s); | |
} | |
writeoutput("listfindnocase: #val(gettickcount()-t)#<br>"); | |
t = gettickcount(); | |
for(i=0; i lte iterations; i+=1){ | |
listfind(lcase(a), lcase(s)); | |
} | |
writeoutput("listfind w/lcase: #val(gettickcount()-t)#<br>"); | |
a2 = lcase(a); | |
s2 = lcase(s); | |
t = gettickcount(); | |
for(i=0; i lte iterations; i+=1){ | |
listfind(a2, s2); | |
} | |
writeoutput("listfind w/pre-lowered: #val(gettickcount()-t)#<br>"); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment