Re: when performance matters

2009-01-31 Thread Isaac Gouy
On Jan 13, 10:07 am, cliffc wrote: -snip- > 5- The debianshootoutresults generally badly mis-represent Java. > Most of them have runtimes that are too small (<10sec) to show off the > JIT, and generally don't use any of the features which commonly appear > in large Java programs (heavy use of v

Re: when performance matters

2009-01-16 Thread Konrad Hinsen
On 13.01.2009, at 19:07, cliffc wrote: > 1- If you think that HotSpot/Java is slower than C++ by any > interesting amount, I'd love to see the test case. Being the I have to admit that I haven't done many tests, but for those I did I found little to no difference, provided the tests have suff

Re: when performance matters

2009-01-15 Thread Mark H.
On Jan 15, 12:09 am, bOR_ wrote: > I remember from 5 years ago that a collegue of mine improved a > diffusion algorithm for a successor of me by some heavy algorithms. My > own algorithm was a simple loop-over-the- array once, dump-a-fraction- > of-each-cell-into-spatially-neighbouring-cells-in-t

Re: when performance matters

2009-01-15 Thread bOR_
I remember from 5 years ago that a collegue of mine improved a diffusion algorithm for a successor of me by some heavy algorithms. My own algorithm was a simple loop-over-the- array once, dump-a-fraction- of-each-cell-into-spatially-neighbouring-cells-in-the-new-array, and sum what is in every cel

Re: when performance matters

2009-01-14 Thread Mark H.
On Jan 14, 6:37 pm, Asbjørn Bjørnstad wrote: > Look closer, I'm using a 1-D array and indexing by hand :-) oops, sorry about that -- i see you are doing the right thing here ;-) > > 3. I noticed you are doing 20 iterations of Gauss-Seidel.  There are > > some smart ways to speed up multiple st

Re: when performance matters

2009-01-14 Thread Asbjørn Bjørnstad
On Jan 15, 4:33 am, Rich Hickey wrote: > Try this (and make sure you are using -server): > > (defn diffuse [grid diff-ratio dt] >   (let [a (float (* dt diff-ratio grid-size grid-size)) >         a4-1 (float (+ 1 (* 4 a))) >         grid #^floats (deref grid) >         diffused-grid #^floats (ma

Re: when performance matters

2009-01-14 Thread rzeze...@gmail.com
On Jan 13, 8:04 am, Mark P wrote: > > A macro cannot depend on runtime information. A macro is a function   > > that is called at compile time, its argument is an expression (as   > > written by the programmer, or as returned by another macro), and its   > > result is a modified expression. There

Re: when performance matters

2009-01-14 Thread Asbjørn Bjørnstad
On Jan 15, 8:42 am, "Mark H." wrote: > On Jan 14, 12:29 pm, chris wrote: > > > For a completely different way of doing this, you could certainly use > > GPGPU programming to speed this up. > > ... > > You want this for a game engine anyway; do it in opengl or directx > > using shaders. > > I re

Re: when performance matters

2009-01-14 Thread Asbjørn Bjørnstad
On Jan 15, 3:38 am, "Mark H." wrote: > On Jan 14, 8:27 am, Asbjørn  Bjørnstad wrote: > > > Anyway, here is a core part of the algorithm. It's a diffusion > > step, this gets called 3 times and in total this takes up more than > > one second of cpu time on my machine which makes framerates very

Re: when performance matters

2009-01-14 Thread Mark H.
On Jan 14, 12:29 pm, chris wrote: > For a completely different way of doing this, you could certainly use > GPGPU programming to speed this up. > ... > You want this for a game engine anyway; do it in opengl or directx > using shaders. I recommend OpenCL or CUDA instead for less pain ;-) (Well,

Re: when performance matters

2009-01-14 Thread Rich Hickey
On Jan 14, 11:27 am, Asbjørn Bjørnstad wrote: > On Jan 14, 12:20 pm, "Mark H." wrote: > > > > > I humbly propose that folks shouldn't complain about Clojure being > > slow for their apps until they have at least one of the following: > > > 1. A targeted benchmark for an important bottleneck i

Re: when performance matters

2009-01-14 Thread chris
For a completely different way of doing this, you could certainly use GPGPU programming to speed this up. This section: (aset diffused-grid c (float (/ (+ (aget grid c) (* a (+ (+ (aget diffused-gr

Re: when performance matters

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 11:27 AM, Asbjørn Bjørnstad wrote: > > Anyway, here is a core part of the algorithm. It's a diffusion > step, this gets called 3 times and in total this takes up more than > one second of cpu time on my machine which makes framerates very > slow. If anyone got any improve

Re: when performance matters

2009-01-14 Thread Mark H.
On Jan 14, 8:27 am, Asbjørn Bjørnstad wrote: > Anyway, here is a core part of the algorithm. It's a diffusion > step, this gets called 3 times and in total this takes up more than > one second of cpu time on my machine which makes framerates very > slow. If anyone got any improvements I'd be hap

Re: when performance matters

2009-01-14 Thread Greg Harman
Asbjxrn, One thing that leaps out to me performance-wise is the 3 nested loops (dotimes, dotimes, loop/recur). Whatever's inside the inner loop is getting run a lot of times! General advice about reducing loop depth and computation required inside the innermost loop aside... have you looked at cl

Re: when performance matters

2009-01-14 Thread Asbjørn Bjørnstad
On Jan 14, 12:20 pm, "Mark H." wrote: > I humbly propose that folks shouldn't complain about Clojure being > slow for their apps until they have at least one of the following: > > 1. A targeted benchmark for an important bottleneck in their > application, implemented in both Clojure and the cur

Re: when performance matters

2009-01-14 Thread Peter Wolf
Rich, I must apologize-- I worded my question *far* too harshly. I knew it as I pushed the send button. I am a huge fan of Clojure, and plan to use it as often as possible. My question was really looking for hints, so that I can use it in more places. You gave me a great one, thanks! Is th

Re: when performance matters

2009-01-14 Thread Rich Hickey
For those interested in numeric performance, Clojure lets you use arrays of primitives, has primitive math support, primitive local support, and has higher-level macros for dealing with them (amap, areduce) which can also serve as models for your own. You can also use :inline to wrap arithmetic pr

Re: when performance matters

2009-01-13 Thread chris
Perhaps this thread is dead, but have you looked at CUDA? A modern GPU has around 100 times the FPU firepower compared to a modern core duo. Whether you can structure your algorithm to suite the hardware is another question and I could help you with that. CUDA isn't as strong on integer but the

Re: when performance matters

2009-01-13 Thread Mark H.
I humbly propose that folks shouldn't complain about Clojure being slow for their apps until they have at least one of the following: 1. A targeted benchmark for an important bottleneck in their application, implemented in both Clojure and the current implementation language, with performance res

Re: when performance matters

2009-01-13 Thread Colin Walters
On Jan 12, 10:21 am, Stuart Sierra wrote: > 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. I wouldn't say "never"; clearly Cl

Re: when performance matters

2009-01-13 Thread Isaac Gouy
On Jan 13, 4:41 am, "Eric Lavigne" wrote: > > > There's also the (in)famous language benchmark > > > site:http://shootout.alioth.debian.org/ > > > This is primarily what I was going on.  I realize no > > benchmarking approach is going to be perfect, but > > this attempt doesn't seem too bad.  I

Re: when performance matters

2009-01-13 Thread Isaac Gouy
On Jan 13, 4:30 am, Mark P wrote: > On Jan 13, 5:49 pm, Zak Wilson wrote: > > > You're probably thinking of > > this:http://www.flownet.com/gat/papers/lisp-java.pdf > > Thanks for the link. > > > There's also the (in)famous language benchmark > > site:http://shootout.alioth.debian.org/ > > Th

Re: when performance matters

2009-01-13 Thread Isaac Gouy
On Jan 13, 10:07 am, cliffc wrote: > Some comments: > > 1- If you think that HotSpot/Java is slower than C++ by any > interesting amount, I'd love to see the test case.  Being the > architect of HotSpot "-server" I've a keen interest in where > performance isn't on par with C.   -snip- > 5- T

Re: when performance matters

2009-01-13 Thread Peter Wolf
Why is Clojure slower than Java? And, can it be fixed? Is it just the dynamic lookups? I also want to use Clojure in my work to implement the inner loops, but I was disappointed by a previous discussion looking at the speed of Clojure. As I recall Clojure seems to be about 1/4 the speed of

Re: when performance matters

2009-01-13 Thread cliffc
Some comments: 1- If you think that HotSpot/Java is slower than C++ by any interesting amount, I'd love to see the test case. Being the architect of HotSpot "-server" I've a keen interest in where performance isn't on par with C. Except for a handful of specialized uses (e.g. high-level interpr

Re: when performance matters

2009-01-13 Thread Mark H.
On Jan 11, 9:41 pm, Mark P wrote: > 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 differenc

Re: when performance matters

2009-01-13 Thread Konrad Hinsen
On Jan 13, 2009, at 14:04, Mark P wrote: > Then what do people mean when they say that lisp blurs > the distinction between compile-time and run-time? I don't know. I can only guess that they may be referring to the fact that many Lisp dialects have both an interpreter and a compiler. Or to

Re: when performance matters

2009-01-13 Thread Mark P
> A macro cannot depend on runtime information. A macro is a function   > that is called at compile time, its argument is an expression (as   > written by the programmer, or as returned by another macro), and its   > result is a modified expression. There is no way a macro could access   > runtime

Re: when performance matters

2009-01-13 Thread Eric Lavigne
> > > > There's also the (in)famous language benchmark > > site:http://shootout.alioth.debian.org/ > > This is primarily what I was going on. I realize no > benchmarking approach is going to be perfect, but > this attempt doesn't seem too bad. Is there any > reason to be particularly sceptical ab

Re: when performance matters

2009-01-13 Thread Mark P
On Jan 13, 5:49 pm, Zak Wilson wrote: > You're probably thinking of > this:http://www.flownet.com/gat/papers/lisp-java.pdf Thanks for the link. > There's also the (in)famous language benchmark > site:http://shootout.alioth.debian.org/ This is primarily what I was going on. I realize no bench

Re: when performance matters

2009-01-13 Thread Konrad Hinsen
On Jan 13, 2009, at 12:30, Mark P wrote: >> Macros are handled at compile time, so they add no run-time overhead. > > But isn't "compile time" sometimes _at_ runtime? Ie, if > a macro is dependent on runtime information, then isn't > it passed to "the compiler" which is included as part of > the

Re: when performance matters

2009-01-13 Thread Mark P
> I am not aware of any auto-parallelizing compiler that is actually   > useful in practice. Good to know - thanks. > > And this leads to another question I have about Lisp-style > > languages in general.  I get the impression that in Lisp > > much of the "compiler" is Lisp code itself.  Ie, lay

Re: when performance matters

2009-01-13 Thread Konrad Hinsen
On 13.01.2009, at 05:35, Mark P wrote: > I know that there are other functional approaches where > the compiler automatically finds ways to parallelize. Is there > much scope for this in Clojure? Or is it all pretty much > manually added concurrency? I am not aware of any auto-parallelizing co

Re: when performance matters

2009-01-12 Thread Zak Wilson
You're probably thinking of this: http://www.flownet.com/gat/papers/lisp-java.pdf There's also the (in)famous language benchmark site: http://shootout.alioth.debian.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

Re: when performance matters

2009-01-12 Thread Zak Wilson
Lisps are not inherently slow. SBCL, Clojure and several Schemes are all much faster than most popular high-level languages (e.g. Python, Perl, Ruby...) while being at least as high-level. Optimized code in SBCL may only be marginally slower than C when type declarations are used properly. The co

Re: when performance matters

2009-01-12 Thread e
There's a study someone did that compared C++, Java, and Lisp implementations of various problems. It could be urban legend, but how I remember it: The best C++ implementation was the fastest for each problem. But the average lisp implementation was faster then the average java or C++ implementat

Re: when performance matters

2009-01-12 Thread Mark P
On Jan 13, 1:21 am, Stuart Sierra wrote: > 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. I think you are essentially right (

Re: when performance matters

2009-01-12 Thread Mark P
> JNA might be an alternative to JNI:https://jna.dev.java.net/ > But I wouldn't know; haven't used either. Thanks for this info. It sounds like JNA may be worth looking into. Cheers, Mark. --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: when performance matters

2009-01-12 Thread Mark P
> 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. I know that there are other functional approaches where the co

Re: when performance matters

2009-01-12 Thread Stuart Sierra
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-desig

Re: when performance matters

2009-01-12 Thread bOR_
This might help: java libraries for fast computing. I guess they will be usable from within clojure as well. http://acs.lbl.gov/~hoschek/colt/ Welcome to the Colt Project. Colt provides a set of Open Source Libraries for High Performance Scientific and Technical Computing in Java. Scientific an

Re: when performance matters

2009-01-12 Thread Christian Vest Hansen
On Mon, Jan 12, 2009 at 6:41 AM, 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. (

Re: when performance matters

2009-01-12 Thread Konrad Hinsen
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 idea

Re: when performance matters

2009-01-11 Thread e
I can't speak for clojure, so I'm interested in seeing how people who can will answer. There's so much to consider. I've heard Haskell is getting faster and has (or will have) parallel programming under the scenes (automatically doing independent parts of operations). There are other fast functi

when performance matters

2009-01-11 Thread Mark P
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