Scoping Variables

Trying to eliminate some implied variable access here.

Let’s say I created MyQuery which contains MyField.
I would normally access that with MyQuery.MyField
But is it proper and/or faster to use variables.MyQuery.MyField ??

tx,
km

Don’t forget to tell us about your stack!

OS: ???
Java Version: ???
Tomcat Version: ???
Lucee Version: ???

1 Like

The answer to all performance questions is always, try it out!

try both approaches and wrap them with <cftimer> :: Lucee Documentation

in a .cfm file, variables is the nearest scope, which Lucee will try first.

The basic rule with cfml scoping is you don’t need to scope the nearest scope.

If you want the best performance and security, use strict cascading