Instantly share code, notes, and snippets.

View trycf-gist-1537652541297-1487cc22-3ab7-2c7c-9d58-c4ca9c560ce4.cfm
<cfscript>
writeOutput("<h1>Performance test for structParamExists()</h1>");
num_iterations = 1*1000*1000;
setLocale("Italian (Standard)");
writeOutput("<br>Num. iterations: #LSNumberFormat(num_iterations, '_,___')#<br>");
attr = {
key1 = "key1"
};
View trycf-gist-1537652066748-89a4469d-8b33-4e06-57ce-21dbcbab4470.cfm
<cfscript>
// Build a fake query object.
HospitalVisits2 = queryNew(
"patientID, Reason_For_Visit",
"integer, varchar",
[
{ patientID: 1, Reason_For_Visit: "Broken leg" }
, { patientID: 1, Reason_For_Visit: "Concussion" }
, { patientID: 1, Reason_For_Visit: "Severe bleeding" }
, { patientID: 1, Reason_For_Visit: "BROKEN LEG" } // Duped value in different case.
View trycf-gist-1537652066748-89a4469d-8b33-4e06-57ce-21dbcbab4470.cfm
<cfscript>
// Build a fake query object.
HospitalVisits2 = queryNew(
"patientID, Reason_For_Visit",
"integer, varchar",
[
{ patientID: 1, Reason_For_Visit: "Broken leg" }
, { patientID: 1, Reason_For_Visit: "Concussion" }
, { patientID: 1, Reason_For_Visit: "Severe bleeding" }
, { patientID: 1, Reason_For_Visit: "BROKEN LEG" } // Duped value in different case.
View trycf-gist-1537651950100-6e5ff7b0-1569-b8c2-3cff-123f2d0145e0.cfm
<cfscript>
// Build a fake query object.
HospitalVisits2 = queryNew(
"patientID, Reason_For_Visit",
"integer, varchar",
[
{ patientID: 1, Reason_For_Visit: "Broken leg" }
, { patientID: 1, Reason_For_Visit: "Concussion" }
, { patientID: 1, Reason_For_Visit: "Severe bleeding" }
, { patientID: 1, Reason_For_Visit: "BROKEN LEG" } // Duped value in different case.
View trycf-gist-1537645167490-abb7c01b-9c4e-3aac-44a7-692f5dc6bfff.cfm
<cfscript>
// Build a fake query object.
HospitalVisits2 = queryNew(
"patientID, Reason_For_Visit",
"integer, varchar",
[
{ patientID: 1, Reason_For_Visit: "Broken leg" }
, { patientID: 1, Reason_For_Visit: "Concussion" }
, { patientID: 1, Reason_For_Visit: "Severe bleeding" }
, { patientID: 1, Reason_For_Visit: "BROKEN LEG" } // Duped value in different case.
View trycf-gist-1537598789582-0660d45a-bc91-af0b-28ae-863b1a5aa696.cfm
<cfscript>
writeOutput("<h1>Performance test for structParamExists()</h1>");
num_iterations = 1*1000*1000;
setLocale("Italian (Standard)");
writeOutput("<br>Num. iterations: #LSNumberFormat(num_iterations, '_,___')#<br>");
attr = {
key1 = "key1"
};
View trycf-gist-1537561368605-6a81326c-a663-7737-41b5-41f8721195ea.cfm
<cfscript>
str = { "foo" = -999 }
writeOutput( serializeJSON(str) );
str.foo = javaCast("boolean", 0);
writeOutput( serializeJSON(str) );
</cfscript>
View trycf-gist-1537552172786-d55b1dfc-f075-d9bc-1841-c56058398cfa.cfm
<cfscript>
num_iterations = 1*1000*1000;
attr = {
key1 = "key1",
key2 = ""
};
start_time = getTickCount();
for(i=1; i<=num_iterations; i++) {
if (structKeyExists(attr, "key1") and len(trim(attr.key1)) gt 0) {