5 ms·
I’ve been meaning to write up my expirement in maximizing the amount of things the IL linker removes: https://github.com/AustinWise/IlLinkerExample/blob/master
by MarkSweep 8y ago
I’ve been meaning to write up my expirement in maximizing the amount of things the IL linker removes:
https://github.com/AustinWise/IlLinkerExample/blob/master/README.md https://github.com/AustinWise/IlLinkerExample/blob/master/RE...
If you are willing to have slower application startup times in exchange for small code, you can disable the ahead of time code generation (crossgen). This gets a self-contained hello world on Windows down to ~10MB. That’s not great for a hello world, but it’s a big improvement over the ~60MB that you get without the linker.
- MaxBarraclough 8y agoSeems to me that's the sensible way to distribute an application. The user probably has a more recent compiler in their .Net runtime, and it enables machine-specific optimisation, right? I'm assuming it's the same compiler either way. It's interesting that they've blended the models traditionally used by the JVM and by Unix. Java: ship the IR, have the user's JIT generate machine-code at the last minute UNIX: ship C source, have the user compile it as part of the installation process .Net: ship the IR and either include machine-code too, or have the user compile it to machine-code, either JIT or caching 'pre-JIT' at install-time (Paint.NET does this) I suppose the 'pre-JIT' approach precludes profile-guided optimisation though, unless the IR is annotated with profiling data.
- pjmlp 8y agoJava: ship the AOT compiled binary, when the company is willing to pay for a 3rd party JDK.
- MaxBarraclough 8y agoSure, the proprietary Excelsior JET ahead-of-time-compiling JVM is out there, but their selling-points are obfuscation and startup-time, not long-running performance. OpenJDK is adding support for AOT compilation. Looks like it's still considered experimental though.
- pjmlp 8y agoThat is just one example. All major commercial JDKs, specially those on the embedded market, support AOT. And then there is that fork called Android as well.
- igouy 8y agoSubstrate VM https://benchmarksgame-team.pages.debian.net/benchmarksgame/faster/java-substratevm.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... (same gz usually means same source code) "Right now peak performance is a bit worse than HotSpot, but we don’t want to advertise that (and we want to fix it of course)." https://www.graalvm.org/docs/reference-manual/aot-compilation/ https://www.graalvm.org/docs/reference-manual/aot-compilatio...
- MarkSweep 8y agoTo clarify, a "self contained" application includes the .NET Core runtime itself (coreclr.dll, System.Private.CorLib.dll, etc). It is also possible to ship just the application and depend on the version of .NET Core installed. Thinking about this a bit more, you could do something similar to what Paint.NET does AOT compile at install time. crossgen.exe is only ~2.5MB, so it would not cost much to ship with the application.