Anonymous functions slower than proper functions?

The problem is that g1 is a non-constant global, if you use

const g1 = t -> cos(t - 0.5 * t^2)

the performance should be the same. (or if you put everything inside a function, making g1 local to the function scope).

2 Likes