Binding Transforms Best Practices

Seat of the pants answer with no performance testing to back it up:
native transforms (ie, mapping) will be faster than
expression transforms will be faster than
script transforms

“Native” transforms are executing as direct Java code in and out.
Expressions have to be parsed and calculated in steps, so there’s more lookups and variable timing involved.
Scripts will almost certainly be the slowest - we have to either grab or create a Python interpreter, compile the function you provide (we do cache these, but it still has to happen) and then finally execute that using the interpreter and handle the result value.

That said - unless you have literally thousands of transforms on a page, you’re much more likely to notice I/O bottlenecks (tag reads, database queries, HTTP traffic) than transform related slowdown problems.

If you, and anyone who has to maintain the project after you, are more comfortable using scripts, then by all means do so. Avoiding using the tool you are best with would definitely fall into premature optimization, in my opinion.

4 Likes