4 ms·
I don't think it is likely to help C++, as templates and `auto` arguments (in C++20) were already specializing. These probably cover most of the cases you'd enc
by celrod 4y ago
I don't think it is likely to help C++, as templates and `auto` arguments (in C++20) were already specializing.
These probably cover most of the cases you'd encounter there.
I'm less familiar with Rust, but I'd have assumed trait implementations specialize there as well.
- josephg 4y ago> I'm less familiar with Rust, but I'd have assumed trait implementations specialize there as well. Yeah - as I understand it, traits + generics in rust monomorphize basically everything. If anything, for rust I want the compiler to learn to do the opposite of this optimization. I'd like the compiler to be able to emit code which uses dynamic dispatch instead of monomorphization when optimizing for code size, or in cold functions. Monomorphization makes the rust compiler slower and rust binaries larger. Outside of hot loops, its often not worth it. You can change this manually by rewriting rust functions to take dyn function pointers instead of <F: Fn> generic arguments. But I'd prefer the compiler to make that choice for me automatically based on PGO or from -Oz.
- pertymcpert 4y agoLLVM can outline code from across multiple functions at -Oz which could help.