Who understands julia's typeinference in depth?

I already opened an issue for some weird typeinference which blocks me optimizing one of my packages.

It would be really great if someone with in-depth julia compiler type-inference knowledge can take a look: Typeinference depends on execution order but should not · Issue #45388 · JuliaLang/julia · GitHub

I haven’t read the specifics of the issue but just note that the success of Julia type inference depending on the order of execution is a well know thing and described pretty well in this blog post: Inference Convergence Algorithm in Julia - Revisited - Julia Computing

Strategies for getting around this that I’ve found work are 1) defining things in a way that limits the need for recursion of two different functions to infer the right type 2) just generally doing anything that makes inference simpler and 3) if its just one specific thing, you can trigger inference in the “good” order in the body of your module, as a sort of “precompilation” (although this might be hard if you can’t anticipate every type that you might need).

2 Likes