Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce number of
getindex(::Type, ...)
methods
Previously, there were special cases for `T[]`, `T[a]`, `T[a,b]` and `T[a,b,c]`. Together with the general case for more elements, that meant five methods to consider in cases like `T[x...]` where the length of `x` was not known at compile time. That was beyond the inference limit and such a call would be inferred as `Any`. So this change gets rid of all the special cases. The loop-based general case worked well if all arguments were of the same type, but otherwise suffered from type-instability inside the loop. Without the special cases for low element count this would be hit more often, so the loop is replaced with a call to `afoldl` that basically unrolls the loop for up to 32 elements.
- Loading branch information