There are three ways to implement generics:
Just a tool for compile time checks, but every template instance is compiled to the same byte/assembly code impl
Swift starts by compiling a single implementation that does dynamic type checking, but the optimizer can then choose to clone off specialized implementations for particular types when the speed vs code size tradeoffs make sense. Ideally, this gets 90% of the speedup of always cloning, without the code size and compilation time exploding.