Skip to content

Instantly share code, notes, and snippets.

@ivanionut
Last active September 7, 2018 20:32
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/76ce7e81f2c45cd2f260474aad9c6167 to your computer and use it in GitHub Desktop.
Save ivanionut/76ce7e81f2c45cd2f260474aad9c6167 to your computer and use it in GitHub Desktop.
<cfscript>
max=10000;
persons = queryNew(
"lastname, firstname",
"cf_sql_varchar, cf_sql_varchar",
[
[ "Lebowski", "Jeffrey" ],
[ "Lebowski", "Bunny" ],
[ "Lebowski", "Maude" ],
[ "Sobchak", "Walter" ]
]
);
// Query of Query
start=getTickCount();
for (i = 1; i <= max; i++) {
queryExecute(
"select * from persons
where lastname='Lebowski'
and firstname='Bunny'
order by lastname ",
{},
{dbtype="query"}
);
}
writeoutput("Query of Query Execution Time:"&(getTickCount()-start));
// Query Filter/Sort
start=getTickCount();
for (i = 1; i <= max; i++) {
qf=queryFilter(persons,function (row,cr,qry) {return row.firstname=='Bunny' && row.lastname=='Lebowski';});
qs=qf.sort(function(rowA, rowB) { return compare(rowA.lastname, rowB.lastname); });
}
writeoutput("<br>Query Filter/Sort Execution Time:"&(getTickCount()-start));
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment