Really, any comparisons between JS and JVM startup times are not useful at all. For a long list of reasons, not limited to:
* CLJS doesn't have Vars, CLJ does * JS VMs are highly tuned for excellent startup times * JVM Bytecode is a binary format expressing classes, JS files are text files expressing functions and data transformations * JVM is class based, JS is prototype based * JVM is multithreaded and designed to handle several GB of data, JS VMs are single threaded and designed to often deal with less than a GB of data. * HotSpot (and most) JVMs are method JITS, JS engines often use many profiling methods that are closer to that of a tracing JIT * The JVM performs extensive security analysis on loaded bytecode, JS engines disallow most security flaws via syntax restrictions * CLJS supports tree shaking and minifcation. All this adds up to an apples-to-oranges comparison. They are completely different platforms, the numbers between the two won't be close, and drawing any sort of comparison between the two isn't very useful at all. -- * No multithreaded safety in vars is not what takes up most of the startup time in Clojure. We're talking about single threaded access (var initing isn't multithreaded) to a primitive that is updated via a CAS. The highest cost you'll see accessing a var in this situation is somewhere in the range of a cache miss or two. On Thu, Jan 25, 2018 at 1:26 PM, Stephen Nelson <step...@montoux.com> wrote: > The JVM is concurrent whereas Javascript VMs are singled-threaded. Var > initialisation in Clojure uses concurrency primitives to ensure that > namespaces are always consistent for all threads, whereas Clojurescript > simply assigns to variables. Our profiling of Clojure on the JVM indicates > that a lot of the time spent in namespace initialisation is spent in > concurrency structures, and this seems much more significant for > non-clojure-core namespaces. > > On Fri, Jan 26, 2018 at 7:22 AM Mikhail Gusarov <dotted...@dottedmag.net> > wrote: > >> cljs vars are not reified. >> >> On Thu, 25 Jan 2018, at 18:24, Didier wrote: >> > Based on the profiling performed here >> > http://clojure-goes-fast.com/blog/clojures-slow-start/ on 1.9, >> > >> > It looks like clojure/core__init.load is the slowest bit with load and >> > requiring spending the most time on, as well as loadClass, followed by >> > clojure/lang/Var.invoke. >> > >> > Wouldn't ClojureScript also need to initialize all Vars and execute top >> > level forms? You'd think that part would be slower in JavaScript no? >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Clojure" group. >> > To post to this group, send email to clojure@googlegroups.com >> > Note that posts from new members are moderated - please be patient with >> > your first post. >> > To unsubscribe from this group, send email to >> > clojure+unsubscr...@googlegroups.com >> > For more options, visit this group at >> > http://groups.google.com/group/clojure?hl=en >> > --- >> > You received this message because you are subscribed to the Google >> > Groups "Clojure" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an email to clojure+unsubscr...@googlegroups.com. >> > For more options, visit https://groups.google.com/d/optout. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > Stephen Nelson | Platform Lead Developer | Montoux > e. step...@montoux.com <n...@montoux.com> > t. @montoux > w. montoux.com > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.