On Mon, Jan 12, 2009 at 6:41 AM, Mark P <pierh...@gmail.com> 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?)
Asuming the right algorithm, single-threaded C++ and no reflection or boxing overhead in Clojure, then I think 2 will do. > > 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.) We're already there. As Konrad said, they optimize differently so objective testing is hard. I think that Java is behind on optimizing cache locality because the structure of the typical Java program makes this a harder problem, that's what I've heard anyway. Sun has some wiki pages on HotSpot specific optmization techniques, which might come in handy when you want to squeeze those last 5% of performance. > > 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.) JNA might be an alternative to JNI: https://jna.dev.java.net/ But I wouldn't know; haven't used either. But instead of interfacing with C++, you might find that simply interfacing with Java will provide enough of a boost in those super-critical sections. Unless, that is, if your C++ is using dirty tricks like CUDA and what-ever-the-AMD-version-is-called. :) > > 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? > > 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? > How realistic are my three "hopes"? And are there > any other performance enhancing possibilities that I > have not taken into account? > > Thanks, > > Mark P. > > > > -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---