r/programming • • Apr 13 '14

Puppet Labs move to Clojure

http://puppetlabs.com/blog/new-era-application-services-puppet-labs
101 Upvotes

30 comments sorted by

View all comments

16

u/strattonbrazil Apr 13 '14

I wish they mentioned performance a bit more. From my personal experiences and almost every benchmark I've ever seen clojure struggles and seems laborious to optimize unless you have a lot of experience with it. I guess it might be comparable to ruby, so it didn't affect them. In my brief use of clojure, the language was very simple and the docs were very easy to use.

9

u/yogthos Apr 13 '14

Could you elaborate on what benchmarks these are exactly. Clojure seems to do pretty well in both the benchmarks game and in the web framework benchmarks.

I'm also not sure what makes Clojure laborious to optimize. Most optimizations tend to revolve around having reflection and Clojure will warn you about functions that are causing reflection when you set the *warn-on-reflection* flag. On top of that the JVM comes bundled with jvisualvm that can be used to easily profile your application and see what actually needs optimizing.

While, without optimizations, the performance is not going to match Java, it's certainly a lot better than Ruby or Python out of the box.

1

u/strattonbrazil Apr 13 '14 edited Apr 13 '14

The scores on the benchmark game seem to have improved a lot since I last looked. However, that seems to be an anomaly. I've heard the benchmark game is slightly flawed, because the tests are so short lived and don't take into account JVM startup. Could be wrong.

These are the kind of tests I've seen the in past, where clojure is an order of magnitude slower than java. If things have really changed that much for it, which is certainly possible, maybe it's time for me to give it another chance.

7

u/bcash Apr 13 '14

That article is mainly talking about the same things as you mention: start-up speed.

And it's true. Clojure apps do have a start-up penalty worse than Java (because they have to load the JVM as well as a whole JAR file full of the Clojure runtime, etc.), there are some mitigations though, and this shouldn't detract from Clojure's use in services (like the stuff mentioned in the original article).

1

u/igouy Apr 14 '14

short lived and don't take into account JVM startup

How much difference do you think that would make for those tiny programs with those workloads?

What about Java® VM warm-up?