<story><title>JavaCPP</title><url>https://github.com/bytedeco/javacpp</url></story><parent_chain><item><author>amelius</author><text>Somewhat off-topic. I recently got interested in Java and its ecosystem because of Clojure. However, what bugs me is the startup time for Java. Since this is mature technology, I cannot believe it takes so long for an executable to start. One guess is that this is because of the garbage collector inside the VM, but that doesn&amp;#x27;t make much sense because NodeJS also uses a garbage collector and it starts instantly (and it even has to parse &amp;amp; compile the code upon startup, which the Java VM doesn&amp;#x27;t even have to do). So... I&amp;#x27;m puzzled. Any comments? This is not meant as a trolling question.</text></item></parent_chain><comment><author>chrisseaton</author><text>It doesn&amp;#x27;t make any sense to blame the garbage collector. During startup you&amp;#x27;re loading classes, allocating structures, and verifying byte code. There aren&amp;#x27;t things that involve garbage collection (allocating with a tracing GC is generally by bump-pointer so is very efficient).&lt;p&gt;I work on a large Java project (JRuby) and for us the largest component of time spent is on loading classes. Also, startup code is likely to run in the interpreter rather than being JIT compiled, which is also slower.&lt;p&gt;The solution we&amp;#x27;re looking at is ahead of time compilation. This avoids class loading and interpretation, and it does seem to solve the problem (we&amp;#x27;re back to ms startup time).&lt;p&gt;In V8 (Node.js) the majority of the core language and library features are effectively already AOT compiled as they&amp;#x27;re implemented in C++. In the OpenJDK (and most JVMs) a lot of this is implemented in Java, so that has to be loaded and interpreted rather than executed natively.</text></comment>
<story><title>JavaCPP</title><url>https://github.com/bytedeco/javacpp</url></story><parent_chain><item><author>amelius</author><text>Somewhat off-topic. I recently got interested in Java and its ecosystem because of Clojure. However, what bugs me is the startup time for Java. Since this is mature technology, I cannot believe it takes so long for an executable to start. One guess is that this is because of the garbage collector inside the VM, but that doesn&amp;#x27;t make much sense because NodeJS also uses a garbage collector and it starts instantly (and it even has to parse &amp;amp; compile the code upon startup, which the Java VM doesn&amp;#x27;t even have to do). So... I&amp;#x27;m puzzled. Any comments? This is not meant as a trolling question.</text></item></parent_chain><comment><author>Hupriene</author><text>Alex Miller is collecting information on impact of clojure&amp;#x27;s slow startup time.  For that and some good discussion of the causes of clojure&amp;#x27;s slow startup time see: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;groups.google.com&amp;#x2F;forum&amp;#x2F;#!msg&amp;#x2F;clojure&amp;#x2F;MG8UTcgFhYc&amp;#x2F;lBiQBoCjAwAJ&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;groups.google.com&amp;#x2F;forum&amp;#x2F;#!msg&amp;#x2F;clojure&amp;#x2F;MG8UTcgFhYc&amp;#x2F;lB...&lt;/a&gt;</text></comment>