Micro-optimize type indirection visitor by JukkaL · Pull Request #19460 · python/mypy

@JukkaL

Specialize iteration for the concrete types `list` and `tuple`,
since this is faster than iterating over an abstract iterable
in compiled code.

Duplicate some very hot code in the hopes further improving
preformance slightly, through inlining and possibly also better
branch prediction.

This is a part of a set of micro-optimizations that improve self check
performance by ~5.5%.

ilevkivskyi