- Published on
Investigation · Part 7 of 10 · Types under the hood
Two Ways to Make a Type Disappear: Erasure and Monomorphization
One generic function used with three types produced three copies in the Rust binary and one function in the JavaScript output. I counted the symbols, found the vtable jump, and argue that monomorphization is a trade most code makes without measuring it.