On 12.01.2009, at 06:41, Mark P wrote:

> 1. Some of the algorithms I use have the potential
> to be parallelized.  I am hoping that as the number
> of cores in PCs increase, at some point Clojure's
> performance will beat C++'s due to Clojure's
> superior utilization of multiple cores.  (Any ideas
> on how many cores are needed for this to become
> true?)

It all depends on your algorithms and your code. Clojure has lots of  
support (data structures and algorithms) for concurrent programming,  
but you have to choose and combine them yourself to get efficient  
parallelization.

> 2. The JVM is continually being improved.  Hopefully
> in a year or two, the performance of HotSpot will be
> closer to that of C++.  (But maybe this is just
> wishful thinking.)

Again this depends a lot on what you are doing. Hotspot is already  
doing an impressive job on some applications, but remains bad at  
others. Optimization of a JIT compiler is quite different from  
optimization by hand: the compiler knows nothing about your algorithm  
at large that could help it to speed up execution, but on the other  
hand it knows where optimization is really useful and it can create  
specialized code versions that no sane person would ever attempt to  
write by hand.

> 3. Maybe I can implement certain performance critical
> components in C++ via the JNI.  (But I get the impression
> that JNI itself isn't particularly efficient.  Also, the more
> I pull over into the C++ side, the fewer advantages to
> using Clojure.)

I also wish there were a better interface between the Java world and  
the C world than JNI. Perhaps there is? I'd happily trade some safety  
for performance.

One source of hope for better interfaces is new virtual machines. One  
candidate is VMKit (http://vmkit.llvm.org/), an implementation of the  
JVM (and .Net as well) on top of LLVM. Combine this with the gcc  
version that produces LLVM code, and it should be possible to get  
Java-C interoperability with much less friction than through the JNI.  
On the other hand, it will be a long time before VMKit matches the  
performance of HotSpot.

> If all else fails, maybe I could use Clojure as a prototyping
> language.  Then when I get it right, I code up the actual
> programs in C++.  But probably a lot would get lost in
> the translation from Clojure -> C++ so would it be worth
> it?

You could also consider writing Clojure code that generates C++ code.  
Or C, or why not directly LLVM.

> I'd love to be convinced that Clojure is a viable choice,
> but I need to be a realist too.  So what do people think?

I am in a very similar situation if I ever want to use Clojure in my  
professional environment. For the moment I have decided that Clojure  
is fun enough to explore even if I never will use it professionally,  
so it's not an immediate concern. Time will tell what can be done  
realistically.

Konrad.

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to