Erasure vs Monomorphization

That generics mean the same thing everywhere. Erasure keeps one body and forgets the type argument; monomorphization emits one body per type argument; reification keeps the type argument available at run time. They produce different performance, different binary sizes and different reflection capabilities from the same-looking source.

Type erasure

When binary size and compile time matter more than per-instantiation speed, and when the run time can afford uniform boxed representations.

Monomorphization

When generic code must be as fast as hand-written code for each type, and you can pay in code size and build time.

AspectType erasureMonomorphization
Bodies emittedOne, shared by every instantiation.One per distinct type argument, transitively.
Representation of valuesUniform — typically a pointer, so primitives are boxed.Native — the type’s own layout, inline.
Calls inside the genericIndirect, through a dictionary or an interface table.Direct, and therefore inlinable.
Binary sizeFlat as instantiations grow.Grows with the number of instantiations; a known cause of large binaries.
Compile timeChecked once.Codegen repeated per instantiation, and it is often the dominant build cost.
At run timeThe type argument is gone, so it cannot be inspected.There is no type argument left — the code was specialized for it.