Anonymous functions in Julia currently have a lot of overhead. However, 
I've come up with a temporary solution to this by writing a little macro 
which speeds up anonymous function calls - all you have to do is wrap your 
functions in @fn and they'll speed up, e.g.

x -> x^2

becomes 

@fn x -> x^2

or

@fn function(x)
  x^2
end

A quick benchmark shows that calling this wrapped function is about 15x 
faster. The macro defined at line 74 of this gist, along with some other 
useful utils:

https://gist.github.com/one-more-minute/8299575

Enjoy!

Reply via email to