cadence
cadence copied to clipboard
Inline small closure functions (e.g: `locationRangeGetter`)
Issue To Be Solved
While adding some runtime changes, I noticed that small closure functions can lead to performance degradations.
e.g: Use of locationRangeGetter function in a hot-path decreased the performance by ~20% (compared to inlining).
old time/op new time/op delta
InterpretRecursionFib-2 2.30ms ± 1% 2.77ms ± 5% 20.21%
Suggested Solution
We should inline such commonly used small closure functions. Currently known ones are:
- [ ]
locationRangeGetter