You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Why the best way to define a function from a performance perspective is to use the expr.Function option. #734
I put a lot of effort to make function calls as fast as possible.
This is still true: The best way to define a function from a performance perspective is to use a Function option.
In your case the map slightly outperforms Function due to a heavy ammount of optimizations. But for general, uncommon func signature results will be different. True for example: func(int, string, int, time.Time, uin16) or any other random funcs signatures.
Activity
mdmcconnell commentedon Nov 27, 2024
This is great, very helpful! I've wondered about this since I make heavy use of functions. It's nice to have data.
antonmedv commentedon Nov 27, 2024
Nice benchmark!
I put a lot of effort to make function calls as fast as possible.
This is still true: The best way to define a function from a performance perspective is to use a Function option.
In your case the map slightly outperforms Function due to a heavy ammount of optimizations. But for general, uncommon func signature results will be different. True for example: func(int, string, int, time.Time, uin16) or any other random funcs signatures.
HoChihchou commentedon Nov 27, 2024
For such a function
func(int, string, int, time.Time, uin16), will the expr.Function be much faster than the map? Or is it just a little faster?antonmedv commentedon Nov 27, 2024
Faster. But on how much - benchmarks are needed.