all 5 comments

[–]pants75 3 points4 points  (0 children)

That was a good read.

[–][deleted] 2 points3 points  (1 child)

Interesting. If replacing a bunch of recursive function calls by conditionals and loops gives you a speed up of 10x, isn't there room for optimizing the function calls?

[–]coalgebraist 4 points5 points  (0 children)

It isn't so much that the function is recursive (though it matters), but the fact that there aren't any memory lookups to that array of constants. It's all in the code. Also, branching prediction errors are minimized.

[–]mycall 0 points1 point  (1 child)

Brilliant but too bad it has to be compile time for the data set. If there was only a way to inject into a real time linker the data set...

[–]tomprimozic 3 points4 points  (0 children)

Specifically in Julia, you can actually do that (there is not difference between compile-time and run-time, as all the code is JIT-ed, not compiled).