Mill is a fast JVM build tool that supports Java and Scala. 2-4x faster than Gradle and 4-10x faster than Maven for common workflows, Mill aims to make your project’s build process performant, maintainable, and flexible
The AFUNIXServerSocket library we are using seems to cause an extra ~500ms latency launching the Mill client, and also causes the Graal native-image to crash during generation.
Using TCP sockets seems to cut the launch overhead down from ~1000ms to ~500ms, and opens up the possibility of using native-image to cut it further.
The JVM also ships with UnixDomainSocketAddress starting from JDK 17 that we can consider using, either by requiring JDK17 or by conditionally using it based on JDK version. But for now I want to keep supporting JDK11 and don't want to split the code paths, so we'll hold off on this for now
jline.terminal.Terminal.getSize also adds a few hundred milliseconds, so we instead use the same tput command that Ammonite uses which takes <10ms.
On windows where tput isn't support, it falls back to 100 cols, which I reduced it down from 120 to hopefully avoid line wrapping in most terminals while still providing a decent experience
Together these two changes cuts down the time taken for a hot time ./mill version on the Mill repo from ~1.05s to ~0.24s
The
AFUNIXServerSocket
library we are using seems to cause an extra ~500ms latency launching the Mill client, and also causes the Graal native-image to crash during generation.Using TCP sockets seems to cut the launch overhead down from ~1000ms to ~500ms, and opens up the possibility of using native-image to cut it further.
Using localhost TCP sockets seems secure as far as I can tell https://security.stackexchange.com/questions/108544/once-established-are-sockets-on-localhost-secure
The JVM also ships with
UnixDomainSocketAddress
starting from JDK 17 that we can consider using, either by requiring JDK17 or by conditionally using it based on JDK version. But for now I want to keep supporting JDK11 and don't want to split the code paths, so we'll hold off on this for nowjline.terminal.Terminal.getSize
also adds a few hundred milliseconds, so we instead use the sametput
command that Ammonite uses which takes <10ms.tput
isn't support, it falls back to 100 cols, which I reduced it down from 120 to hopefully avoid line wrapping in most terminals while still providing a decent experienceTogether these two changes cuts down the time taken for a hot
time ./mill version
on the Mill repo from ~1.05s to ~0.24s