Why is Clojure so slow?
martinsprogrammingblog.blogspot.de
Why is Clojure so slow?
1–10 of 97 posts
Re: Why is Clojure so slow?
#2(def x 1) ; x = 1 (def x 2) ; x = 2 now
(defconstant y 1) ; y = 1 (defconstant y 2) ; Exception
Also a way of fixing functions would be good, so that no lookup is required. Calling such a fixed function has no overhead, it would be a direct call.
Re: Why is Clojure so slow?
#3http://lists.nongnu.org/archive/html/chicken-users/2011-03/m...
http://lists.nongnu.org/archive/html/chicken-users/2011-03/m...
Re: Why is Clojure so slow?
#4Another approach to the problem would be similar to FastCGI: keep one Clojure server process running and execute scripts on it.
Re: Why is Clojure so slow?
#5If Clojure could dump the Lisp image like SBCL's save-lisp-and-die function, the startup time would be greatly reduced. I wonder if JVM itself can dump its current state and then restore execution. Another approach to the problem would be similar to FastCGI: keep one Clojure server process running and execute scripts on it.
Re: Why is Clojure so slow?
#6If Clojure could dump the Lisp image like SBCL's save-lisp-and-die function, the startup time would be greatly reduced. I wonder if JVM itself can dump its current state and then restore execution. Another approach to the problem would be similar to FastCGI: keep one Clojure server process running and execute scripts on it.
It's still hard to understand why aren't Oracle working on something like that. It's not as if they don't care about desktop at all -- JavaFX is going to be part of Java8 and they are even working on a new packaging tool-chain for it. JVM's start-up time and inability to allocate memory when needed (as compared to up-front way it's done now) are the major reasons why Java/JVM is (still) a bad solution for desktop and cli applications.
Re: Why is Clojure so slow?
#7If Clojure could dump the Lisp image like SBCL's save-lisp-and-die function, the startup time would be greatly reduced. I wonder if JVM itself can dump its current state and then restore execution. Another approach to the problem would be similar to FastCGI: keep one Clojure server process running and execute scripts on it.
Note that this addresses JVM startup overhead, but still not Clojure startup overhead (two are separate).
Re: Why is Clojure so slow?
#8If we can make working websites and even games in Python, we can make them in Clojure too. What kills Clojure for small scripts and not-long-running applications is the startup time and that can mostly be attributed to JVM. Also, the memory footprint of a JVM process tends to grow a lot over time.
I see Clojure rising above specific platforms, though. JVM is in a slow death spiral. CLR might have some traction on Windows. If Python got it platform resettled on something more sophisticated than CPython, that might be a good ecosystem for Clojure.
Re: Why is Clojure so slow?
#9If it takes me 3 months to deliver a given program in Clojure and 6 to deliver its Java equivalent, the Clojure one already has 3 months of lead. Assuming the Java one is twice as fast, it'll take 45 days to catch up.
Development time is expensive, computers are cheap and get twice as fast every year or so.
While a long startup time is annoying, it can certainly be optimized out if someone focuses enough attention to the low level aspects of the runtime.
Re: Why is Clojure so slow?
#10What I would like to see is a `defconstant` macro, which introduces a constant that can not be changed anymore without restarting the JVM. (def x 1) ; x = 1 (def x 2) ; x = 2 now (defconstant y 1) ; y = 1 (defconstant y 2) ; Exception Also a way of fixing functions would be good, so that no lookup is required. Calling such a fixed function has no overhead, it would be a direct call.