top | item 40303831

(no title)

yw3410 | 1 year ago

You can't be as aggressive at removing functions in Java than in Rust though since it's dynamic dispatch (e.g., if you use toString once in your code, you need to keep all implementations of toString which are reachable even if users don't use reflection).

discuss

order

neonsunset|1 year ago

.NET's trimmer/linker deals with this quite well, only referenced or otherwise observable .ToString() implementations are rooted.

Without it 1.6-2MiB-sized AOT binaries would not have been possible (most space is occupied by standard library/runtime bits and GC)

pjmlp|1 year ago

Except that is what jlinker, and GraalVM/OpenJ9 (among other AOT toolchains) do in practice.