The ColdFusion Evaluate() function is often used to resolve dynamically named variables, such as form variables.
The evaluate function, however, forces ColdFusion to compile the expression being evaluated every time you call it, which can be a strain on performance, especially since parts of the compilation process are necessarily single-threaded.
Almost all instances of Evaluate() can be avoided by using structure syntax; instead of writing:
You can write:
Which is much faster, and better yet, simpler.
This doesn't work quite so well when looping over a query, however. If you use structure syntax to access a query column, you must also specify the row number. So, where this would work:
You'd have to use q.currentrow to get the correct row when avoiding evaluate():
Classes created for evaluate() [and de() and setVariable()] are cached on a literal string basis (sorta like cached queries work for the exact string of the query), so the performance impact isn't quite so bad, so long as the literal string for evaluate() doesn't change every time.