9 ms·
JVM startup is sub-second. Still not great for e.g. small command line utilities, but completely fine otherwise.
by sz4kerto 7y ago
JVM startup is sub-second. Still not great for e.g. small command line utilities, but completely fine otherwise.
- fnord123 7y agoJVM startup for `java -version` is around 150ms on my machine: $ time java -version openjdk version "11.0.1" 2018-10-16 OpenJDK Runtime Environment 18.9 (build 11.0.1+13) OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode) real 0m0.159s user 0m0.116s sys 0m0.052s This is how long it takes for a program like git to do actual work. Once you start running an actual program like Maven, it blows up to 500ms for `mvn -version`: $ time mvn -version > /dev/null real 0m0.570s user 0m0.431s sys 0m0.145s Bazel takes 150ms to do nothing: $ time bazel --version > /dev/null real 0m0.144s user 0m0.028s sys 0m0.063s As a baseline, make takes under 30ms to do nothing: $ time make -version > /dev/null real 0m0.025s user 0m0.002s sys 0m0.016s
- jhasse 7y agoSeems similar on my system. Some more comparisions: Waf written in Python: $ time ./waf --version >/dev/null real 0m0,068s user 0m0,056s sys 0m0,012s Ninja written in C++: $ time ninja --version >/dev/null real 0m0,001s user 0m0,001s sys 0m0,000s
- cromwellian 7y agoWith Graal AOT you can make command line utilities that start on the order of 0.008s https://github.com/graalvm/graalvm-demos/tree/master/java-kotlin-aot https://github.com/graalvm/graalvm-demos/tree/master/java-ko...
- pjmlp 7y agoJava 13 takes 97ms on Windows 10, and I haven't bothered to produce a Java native image before attempting it. PS C:\Workdir> Measure-Command { java -version } openjdk version "13" 2019-09-17 OpenJDK Runtime Environment (build 13+33) OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing) Days : 0 Hours : 0 Minutes : 0 Seconds : 0 Milliseconds : 97 Ticks : 975572 TotalDays : 1.12913425925926E-06 TotalHours : 2.70992222222222E-05 TotalMinutes : 0.00162595333333333 TotalSeconds : 0.0975572 TotalMilliseconds : 97.5572 About 60 ms more than make. Hurray Make still wins, now what are we going to do with those 60ms... /s
- lultimouomo 7y agoFWIW, I don't think "java -version" is a good benchmark of java startup time - why should it start up the JVM just to print the version?
- pjmlp 7y agoI think that measuring anything less than 1s for CLI is silly, school playground measuring competition.
- fnord123 7y agoThe original comment was "JVM startup is sub-second. Still not great for e.g. small command line utilities, but completely fine otherwise." For tooling it matters. Some scripts will have backticks and $() and each use of these could be up to a second and be acceptable? Not really. And if you want to run a command like `go fmt` every time you save a file in $EDITOR then you want it to be fast. Maybe when we use the Language Server Protocol everywhere, it will be a different world. But a lot of editors shell out for these features still - and you would never dream of shelling out to e.g. `mvn dependency:tree` because it's too slow.
- pjmlp 7y agoUnless I am missing something, 97ms looks pretty much sub-second to me.
- frankgrimes97 7y ago$ time ./java -version openjdk version "14-ea" 2020-03-17 OpenJDK Runtime Environment (build 14-ea+19-824) OpenJDK 64-Bit Server VM (build 14-ea+19-824, mixed mode, sharing) real 0m0.074s user 0m0.063s sys 0m0.025s
- paulddraper 7y ago> make takes under 30ms to do nothing: But in large code bases, make can take several seconds to do nothing, depending on the number of `$(shell find)`. Whereas Bazel's time remains constant. Could it have been constantly 30ms instead of 150ms? Sure. But that's nowhere near to being a problem for the usual code bases Bazel operates on.