Why the best way to define a function from a performance perspective is to use the expr.Function option. #767
Replies: 4 comments 1 reply
|
This is great, very helpful! I've wondered about this since I make heavy use of functions. It's nice to have data. |
|
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. |
|
For such a function |
|
Faster. But on how much - benchmarks are needed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Quoted from documentation(https://expr-lang.org/docs/functions)
This is my benchmark test:
And result
The performance of map and function methods are very close, there is no particularly obvious difference, and map method is even faster.
All reactions