Over and over again, I've found that via the implicit access debugging shows that the arguments scope is a real bottleneck for Lucee applications. I guess this is partly due to the local scope taking precedence over arguments.
But I just ported an old cf8 application across and I could only achieve the same CF8 performance after scoping all the arguments.
A lot of the PRs I have made for Lucee all involved just var scoping arguments, often inside tiny functions, which produced huge performance increases.
I know there is some overhead with debugging, the unscoped variable debugging bypasses certain scopes like UDF this, super and static.
a static approach like shown in the link above, is not very performant, but for sure faster than any dynamic approach.
i created a test
and it shows a difference of around 12% on a more or less empty function with one read and write access. When i only do a read access the difference goes down to 4%, so write access seems worse than read access.
We also see that no scope access when the requested variables is in the local scope is nearly identical to define a scope.
Possible solutions on this.
Improve the current solution without any changes in logic (unlikely to have success)
add the possibility to set the argument scope to read only (little success)
integrate the argument scope into the local scope as ACF does (ugly but will improve performance)
add a flag to merge the scope, so “arguments” will simply be an alias for “local“ (big success but will affect the logic of current applications)