I decided to benchmark JVM startup again, in case of any doubt, and because 
I see plenty of FUD on this issue.

Code is 
here: 
https://github.com/mikera/miscellania/blob/master/src/main/java/hello/world/App.java
timecmd bat file use to benchmark is in this SO 
answer: http://stackoverflow.com/a/6209392/214010

C:\xxx> java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

C:\xxx> timecmd java -cp miscellania.jar hello.world.App
Hello World!
command took 0:0:0.10 (0.10s total)

As you can see JVM startup is 0.1s or less: in fact the entire execution of 
Hello World took 0.1 sec on my machine. Note that this is the server VM. I 
did about 20 successive runs which were all in the 0.08 to 0.12 sec range.

On Friday, 29 March 2013 17:02:34 UTC+8, John Szakmeister wrote:

> On Thu, Mar 28, 2013 at 9:26 PM, Mikera <mike.r.an...@gmail.com<javascript:>> 
> wrote: 
> > On Friday, 29 March 2013 05:45:53 UTC+8, Laurent PETIT wrote: 
> >> 
> >> 2013/3/28 Marko Topolnik <marko.t...@gmail.com>: 
> >> > Or you may have just a trivial requirement for a program that both 
> >> > starts 
> >> > and executes quickly. 
> >> 
> >> To what extent would an LLVM / C version of a Clojure program not 
> >> incur startup penalty as the JVM does. 
> >> 
> >> As far as I understand it, the startup cost is manyfold: 
> >> 1/ JVM startup 
> >> 2/ loading of Clojure Core 
> >> 3/ loading of non-lazy parts of your application (generally from 
> >> loading a global namespace to invoke its -main function) 
> > 
> > In my experience 1) is a small fraction of the total. A trivial "hello 
> > world" Java program runs in less than 0.1sec on my machine, which proves 
> > that JVM startup isn't really important. Or at least, far less important 
> > than most people think. 
>
> I certainly don't see that.  I've measured this more than a few times, 
> and it's several seconds for a simple "Hello World" Java application 
> on any machine that I can touch.  Additionally, on an embedded system, 
> I'm not going to have the same kind of CPU power.  For instance, the 
> current processor we use runs at 400MHz instead of your desktop's 
> 3GHz. 
>

I suggest you recheck your measurement approach / configuration. See above 
:-)

Agreed that any embedded processor is likely much slower than a PC (mine is 
a laptop in fact). And IO speed probably makes a big difference as well if 
there are caching effects / large .jar files to load.
 

>
> [snip] 
> > It might even be slower in LLVM / C, unless you can at least match the 
> JVM 
> > in terms of JIT optimisation and garbage collector efficiency, which in 
> turn 
> > affects the runtime for 2+3 (I believe a garbage collector is a 
> requirement 
> > to execute Clojure?). Beating the JVM isn't an easy feat. 
>
> You could argue the same for any application written in C, though I 
> think in practice C keeps up pretty well.  However, raw execution 
> speed isn't necessarily my goal.  More interesting to me is having 
> better tools to use.  Clojure's approach to concurrent programming is 
> world's better that the "share everything" approach used in C, and 
> it's that facility that I'd like to use the most.  But requiring the 
> JVM to use it--in my environment--is just too high of a price to pay. 
> To be honest, LLVM might be too high as well.  LLVM is certainly far 
> from small and lightweight. :-) 
>

Agreed - the JVM is a poor fit for very tightly constrained environments. 
Excited to see what you can achieve here! 

Just don't knock the JVM unfairly, it is one of the best tools we have :-)

-- 
-- 
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/groups/opt_out.


Reply via email to