cadence icon indicating copy to clipboard operation
cadence copied to clipboard

Inline small closure functions (e.g: `locationRangeGetter`)

Open SupunS opened this issue 4 years ago • 0 comments

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

SupunS avatar Feb 28 '22 16:02 SupunS