How to avoid compiling methods for different types when @nospecialize doesn't seem to work?

One suggestion I have is defining a type that holds a Tuple of length 4, and has an additional integer indicating it’s length. Then you can write manual dispatches in your code for the 0/1/2/3/4 cases.
This emulates what the compiler would ideally be doing, but being explicit gives you more control.

1 Like