ryan
05/04/2023, 1:24 PMbdw429s
05/04/2023, 1:32 PMbdw429s
05/04/2023, 1:32 PMaliaspooryorik
bdw429s
05/04/2023, 1:39 PMbdw429s
05/04/2023, 1:39 PMryan
05/04/2023, 1:45 PMryan
05/04/2023, 1:50 PMAdam Cameron
even if it is minisculeWhy though? If one was dealing with a performance issue (which is when one ought to start thinking about this sort of thing... and not before then), one would want to find things that have a decent amount of gain. Not immeasurable ones. I cannot give you any tangible metrics, but as Brad alludes to... it's not the CFML code - tags or script - that is executed, so it's not really a consideration. One or the other might have a slightly higher compilation time, but that is negligible to the point of not being apparent, and is a one-time (-ish) cost anyhow, really. The code that the CFML dev writes is gonna be where optimisation opportunities will lie. Not in this sort of stuff. At the same time, one can have real tangible gains for the humans every day if one maintains well-written, clean, easy to reason code. And I'd say that is more readily achieved with less effort in script-based code than tag-based code. Use tags in yer views (and a very limited subset of tags at that). Use script everywhere else. When a performance issue comes along, start by looking at what the code is doing. Not which syntax variant it's written in.
ryan
05/04/2023, 2:20 PMMark Takata (Adobe)
05/04/2023, 3:03 PMryan
05/04/2023, 3:07 PMMark Takata (Adobe)
05/04/2023, 3:07 PMMark Takata (Adobe)
05/04/2023, 3:07 PMMark Takata (Adobe)
05/04/2023, 3:07 PMMark Takata (Adobe)
05/04/2023, 3:07 PMryan
05/04/2023, 3:07 PMMark Takata (Adobe)
05/04/2023, 3:08 PMMark Takata (Adobe)
05/04/2023, 3:08 PMryan
05/04/2023, 3:08 PMMark Takata (Adobe)
05/04/2023, 3:08 PMMark Takata (Adobe)
05/04/2023, 3:08 PMbdw429s
05/04/2023, 3:09 PMMark Takata (Adobe)
05/04/2023, 3:09 PMbdw429s
05/04/2023, 3:09 PMMark Takata (Adobe)
05/04/2023, 3:10 PMbdw429s
05/04/2023, 3:10 PMbyron70
05/04/2023, 3:10 PM<http://cfscript.me|cfscript.me>
. I should call it a day.ryan
05/04/2023, 3:15 PMzackster
05/04/2023, 3:33 PMaliaspooryorik
foundeo
Adam Cameron
Adam Cameron
<cfset i=1>
<cfloop condition="i le 100000">
<cfset i++>
But no difference making that change.bdw429s
05/04/2023, 3:53 PMbdw429s
05/04/2023, 3:53 PMbdw429s
05/04/2023, 3:53 PMbdw429s
05/04/2023, 3:54 PMAdam Cameron
cfloop
in CFScript I'm gonna have to break your arms. Off.bdw429s
05/04/2023, 3:54 PMfoundeo
bdw429s
05/04/2023, 3:54 PMfoundeo
zackster
05/04/2023, 3:55 PMbdw429s
05/04/2023, 3:55 PMloop from=1 to=5 {}
and not
cfloop( from=1, to=5 ) {}
foundeo
zackster
05/04/2023, 3:59 PMzackster
05/04/2023, 4:00 PMpublic final Object call(PageContext paramPageContext) throws Throwable {
<http://paramPageContext.us|paramPageContext.us>().set(this.keys[0], Caster.toRef(GetTickCount.call(paramPageContext)));
paramPageContext
.write("\r\n");
double d1 = 1.0D, d2 = 100000.0D, d3 = 1.0D;
boolean bool = (d3 > 0.0D) ? true : false;
if ((d3 != 0.0D)) {
VariableReference variableReference = VariableInterpreter.getVariableReference(paramPageContext, "i");
variableReference.set(d1);
double d = d1;
while (true) {
if (bool ? ((d <= d2)) : ((d >= d2))) {
paramPageContext
.write("\r\n ");
<http://paramPageContext.us|paramPageContext.us>().set(KeyConstants._X, Operator.plusRef(<http://paramPageContext.us|paramPageContext.us>().get(KeyConstants._I), ConstantsDouble._1));
paramPageContext
.write("\r\n");
variableReference.set(d += d3);
continue;
}
break;
}
}
paramPageContext
.write("\r\n");
paramPageContext.outputStart();
try {
paramPageContext.write(Caster.toString(Caster.toDoubleValue(Operator.minusRef(Caster.toRef(GetTickCount.call(paramPageContext)), <http://paramPageContext.us|paramPageContext.us>().get(this.keys[0])))));
paramPageContext.write("ms");
} finally {
paramPageContext.outputEnd();
}
paramPageContext
.write("\r\n<hr>\r\n");
if (true) {
<http://paramPageContext.us|paramPageContext.us>().set(this.keys[0], Caster.toRef(GetTickCount.call(paramPageContext)));
<http://paramPageContext.us|paramPageContext.us>().set(KeyConstants._I, ConstantsDouble._1);
for (; !(Operator.compare(<http://paramPageContext.us|paramPageContext.us>().get(KeyConstants._I), 100000.0D) > 0); Operator.unaryPoPl(paramPageContext, KeyConstants._I, 1.0D))
<http://paramPageContext.us|paramPageContext.us>().set(KeyConstants._X, Operator.plusRef(<http://paramPageContext.us|paramPageContext.us>().get(KeyConstants._I), ConstantsDouble._1));
WriteOutput.call(paramPageContext, Caster.toString(Caster.toDoubleValue(Operator.minusRef(Caster.toRef(GetTickCount.call(paramPageContext)), <http://paramPageContext.us|paramPageContext.us>().get(this.keys[0])))));
}
return null;
}
foundeo
zackster
05/04/2023, 4:01 PMfoundeo
bdw429s
05/04/2023, 4:02 PMbufferOutput
is set to false, the whitespace isn't even collected in the first placeAdam Cameron
Adam Cameron
zackster
05/04/2023, 4:08 PMzackster
05/04/2023, 4:10 PMpaolo79
05/10/2023, 9:37 AMAdam Cameron
zackster
05/10/2023, 9:47 AMAdam Cameron
<cfset i=1>
<cfloop condition="i LE iteration">
<!---...--->
<cfset i++>
</cfloop>
Might not make a diff, but at least use comparable code.Adam Cameron
Adam Cameron
Adam Cameron
zackster
05/10/2023, 10:01 AMAdam Cameron
zackster
05/10/2023, 10:05 AMAdam Cameron
arrayNew(1).set(1,1000000, "").each(()=>{return})
#mePicksUpBeer
(oh and for shits and giggles time that one. EEEEEEEEEK)Adam Cameron
zackster
05/10/2023, 11:09 AMdouble d = d4;
while (true) {
if (bool1 ? ((d <= d5)) : ((d >= d5))) {
<http://paramPageContext.us|paramPageContext.us>().set(KeyConstants._X, Operator.plusRef(<http://paramPageContext.us|paramPageContext.us>().get(KeyConstants._I), ConstantsDouble._1));
variableReference.set(d += d6);
continue;
}
break;
}
while for loop is doing more gymnastics
for (; !(Operator.compare(<http://paramPageContext.us|paramPageContext.us>().get(KeyConstants._I), <http://paramPageContext.us|paramPageContext.us>().get(this.keys[0])) > 0); Operator.unaryPoPl(paramPageContext, KeyConstants._I, 1.0D))
<http://paramPageContext.us|paramPageContext.us>().set(KeyConstants._X, Operator.plusRef(<http://paramPageContext.us|paramPageContext.us>().get(KeyConstants._I), ConstantsDouble._1));
Adam Cameron
for
can be any expression that evaluates to a boolean (second one), or anything at all (third one). It's a far more flexible construct.Adam Cameron
Adam Cameron
i=1
for (;true;){
writeOutput(i)
if (++i > 10) break;
}
Works fine.