4 ms·
In fact JVM is pretty fast. If you run a simple java app without dependencies and only displaying "Hello world" it will run in about 1s on modern hardware. The
by mateuszf 12y ago
In fact JVM is pretty fast. If you run a simple java app without dependencies and only displaying "Hello world" it will run in about 1s on modern hardware.
The problem with Clojure is AFAIR related to parsing and loading a big number of namespaces which is quite slow.
- fijal 12y ago1s to print hello world is an awful lot I would like to point out.
- potatosareok 12y agoUpvoted you because I agree. JVM has many strong points but I don't think anyone is disputing that startup time is a weakness. I've used some java tools that you invoke from a command line and I'm always slightly annoyed by how slow they are. As an aside - I was trying to reduce -Xmx to improve HelloWorld startup (lol idk...) and Xmx smaller then 1024k and it couldn't start up with less then 1024k so there's that. On my windows computer (also I barely know what I'm doing so probably even timing it wrong). [Mon Mar 09 03:22:31 zebra@ZEBRA:~ ] $ time a.exe Hello, world real 0m0.098s user 0m0.015s sys 0m0.015s [Mon Mar 09 03:22:34 zebra@ZEBRA:~ ] $ time java Hello Hello, world! real 0m0.285s user 0m0.000s sys 0m0.031s
- unstabilo 12y agoHello World execution time benchmark in many languages: http://lists.nongnu.org/archive/html/chicken-users/2011-03/msg00070.html http://lists.nongnu.org/archive/html/chicken-users/2011-03/m... With Haskell: http://lists.nongnu.org/archive/html/chicken-users/2011-03/msg00090.html http://lists.nongnu.org/archive/html/chicken-users/2011-03/m...
- lmm 12y agoWorry about -Xms rather than -Xmx for startup times. I suspect there are ways to make it faster (e.g. there's a nashorn runner that starts up appreciably faster than "proper" java), but the main use case for java is server-side programs that run for days or weeks between restarts, so it's optimized for that use case.
- kyllo 12y agothe main use case for java is server-side programs that run for days or weeks between restarts, so it's optimized for that use case. Unfortunately for the folks who still have to use Java desktop software written in Swing.
- mateuszf 12y agoSure it's a lot, but clojure startup times are significantly longer than that.
- ajuc 12y ago> If you run a simple java app without dependencies and only displaying "Hello world" it will run in about 1s on modern hardware. > time for x in $(seq 1 100); do ./helloworld.py ; done real 0m1.240s user 0m0.902s sys 0m0.343s That's reasonably fast. Java for comparison: > time for x in $(seq 1 100); do java Hw; done real 0m4.952s user 0m4.051s sys 0m1.071s And I had to compile java first. Still, I expected worse from java TBH.
- virmundi 12y agoOut of curiosity which Java? OpenJDK or Oracle or IBM?
- pron 12y agoYou mean 60-80ms. Not 1s. Try it.