Comment by nextaccountic

Comment by nextaccountic a day ago

0 replies

The real problem are generics. They cause a blowup in size because they are instantiated at every type combination that is actually called. This can sometimes be a performance boost (typically not because it avoids an indirect call, but because it enables optimizations such as inlining). But it can also makes code slower (not by much), or have little effect on performance

Rust lets you choose between generics and trait objects, but this is a viral change that sometimes means that large sections of code must be rewritten. There is also an optimization that turns generics into virtual dispatch if deemed beneficial, but I'm not sure how well it works