Partial Specialization of Code

Does julia optimize code where the types of some variables are known approximately but not exactly? For example, this issue makes the return type of slicedim either an n or n+1 dimensional array. Are there performance benefits?

Jared Crean

There are fast paths for unions with less than a certain number of types in them.

Where is this documented? I read stuff in the past that this could be done, but I wasn’t aware it was implemented.