Okay, I'm one of Clojure's biggest fans, and probably one of a very few using it regularly at work. But let me attempt to inject some reality into the discussion. The big advantages of Clojure are succinctness and expressiveness within a Java environment. If you have highly-optimized, custom-designed numerical algorithms written in a low-level language like C++, you will never be able to write a version that is equally fast in a dynamic, virtual-machine language. Compilers are smart, but they are not that smart. Relying on constantly-improving compilers is a dangerous wager. Parallelism may help, but adapting non-parallel algorithms to parallel computation is fiendishly difficult, and the performance aspects of parallel computing are net yet well understood.
That being said, experience is the only reliable guide. If you want to know if Clojure will work for your job, the only thing to do is try it. -Stuart Sierra On Jan 12, 12:41 am, Mark P <pierh...@gmail.com> wrote: > I have recently found out about Clojure and am > rather impressed. I am seriously considering > whether Clojure is a viable language for use at > work. The main stumbling block would be if > performance (both speed and memory) turns out > to be insufficent. I currently use C++, but I'd love > to be able to leave C++ behind and use Clojure > (or similar) instead. > > The programs I write perform applied mathematical > optimization (using mainly integer arithmetic) > and often take hours (occasionally even days) > to run. So even small percentage improvements > in execution speed can make a significant > practical difference. And large problems can use > a large amount of memory - so memory efficiency > is also a concern. > > Given these performance considerations, at first > glance Clojure does not seem like a good choice. > But I don't want to give up on the idea just yet. > The allure of modernized lisp-style programming > is really tempting. > > There are three key factors that still give me > hope: > > 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?) > > 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.) > > 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.) > > 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. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---