Earlier quoted context omitted.
You don't want these optimisations to be on by default. Trimming can cause bugs when your program or one of its libraries relies on reflection and Native AOT is good for startup time (FaaS), but tiered JIT will likely outperform it in long-running applications.
> when your program or one of its libraries relies on reflection Fair enough; perhaps it'd be worthwhile to throw a compiler error if both reflection and trimming were attempted. > Native AOT is good for startup time (FaaS), but tiered JIT will likely outperform it in long-running applications This is intriguing; could you elaborate on the latter? Would tiered JIT perhaps have more runtime information which would be…
In language/platform with dynamic loading, it's hard for the compiler to "perfectly" predict which piece of code will ending up being executed at compile time. I think would result in a lot of false positives.