Re: Can Clojure be as fast as Java?

2009-08-14 Thread evandi
Oh, sorry I didn't realize that your post was delayed. So I guess my other response was irrelevant. On Aug 14, 4:47 pm, fft1976 wrote: > On Aug 12, 1:30 am, Nicolas Oury wrote: > > > Next laziness was thought to be too slow to be practical, and now > > someone used ghc in this thread as an exam

Re: Can Clojure be as fast as Java?

2009-08-14 Thread evandi
I think Andy's number 10 program is only 3 times slower now. On Aug 14, 4:47 pm, fft1976 wrote: > On Aug 12, 1:30 am, Nicolas Oury wrote: > > > Next laziness was thought to be too slow to be practical, and now > > someone used ghc in this thread as an example of fast language. > > There is a lo

Re: Can Clojure be as fast as Java?

2009-08-14 Thread Richard Newman
> P.S. The moderators (Chouser) are now censoring my posts, so if you > don't see this message on the list as well, I wrote something they > want to suppress. As a random member of this community, I'd rather you didn't insinuate this kind of thing. Your messages are being moderated for *tone*

Re: Can Clojure be as fast as Java?

2009-08-14 Thread fft1976
On Aug 12, 1:30 am, Nicolas Oury wrote: > Next laziness was thought to be too slow to be practical, and now > someone used ghc in this thread as an example of fast language. There is a lot of misinformed people (and fanboys who are not misinformed but willing to "exaggerate", putting it charita

Re: Can Clojure be as fast as Java?

2009-08-13 Thread rob
Piyush, I would have to disagree. If fft1976 was a troll then he wouldn't be contributing meaningfully and substantively to testing performance in Clojure on another thread. So I think your accusation was unfair. That said, I did find some of fft1976's comments to be somewhat unnecessarily test

Re: Can Clojure be as fast as Java?

2009-08-12 Thread John Harrop
On Wed, Aug 12, 2009 at 5:25 AM, Piyush Ranjan wrote: > This is a troll question. I have seen similar questions posted on other > forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran, > bigloo(?) etc by the same poster. Hmm. fft1976 = WrexSoul? --~--~-~--~~---

Re: Can Clojure be as fast as Java?

2009-08-12 Thread Chouser
On Wed, Aug 12, 2009 at 4:36 PM, fft1976 wrote: > On Aug 12, 2:25 am, Piyush Ranjan wrote: >> This is a troll question. I have seen similar questions posted on other >> forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran, >> bigloo(?) etc by the same poster. >> >> Try this link

Re: Can Clojure be as fast as Java?

2009-08-12 Thread fft1976
On Aug 12, 2:25 am, Piyush Ranjan wrote: > This is a troll question. I have seen similar questions posted on other > forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran, > bigloo(?) etc by the same poster. > > Try this link:http://www.google.co.in/search?q=fft1976%40gmail.com

Re: Can Clojure be as fast as Java?

2009-08-12 Thread tmountain
Primitives can only be stored inside a local (i.e., a let binding). Primitives are auto-boxed everywhere else. A type hint implies an object (not a primitive). See this post for more info. http://groups.google.com/group/clojure/msg/1e0d52ae931c730d Travis On Aug 12, 5:54 am, Tayssir John Gabbou

Re: Can Clojure be as fast as Java?

2009-08-12 Thread Piyush Ranjan
This is a troll question. I have seen similar questions posted on other forums about languages like ruby, CL, Haskell, Prolog, C, C++, fortran, bigloo(?) etc by the same poster. Try this link: http://www.google.co.in/search?q=fft1976%40gmail.com On Wed, Aug 12, 2009 at 2:00 PM, Nicolas Oury wrot

Re: Can Clojure be as fast as Java?

2009-08-12 Thread Meikel Brandmeyer
Hi, On Aug 12, 12:44 pm, Tayssir John Gabbour wrote: > Ok, so a function like + avoids this boxing, because it's really > replaced by a call to clojure.lang.Numbers.add()... And looking at the > sourcecode, this is accomplished through :inline. This :inline > declaration allows + to avoid IFn's

Re: Can Clojure be as fast as Java?

2009-08-12 Thread Tayssir John Gabbour
Ah, thanks Meikel for the explanation. Ok, so a function like + avoids this boxing, because it's really replaced by a call to clojure.lang.Numbers.add()... And looking at the sourcecode, this is accomplished through :inline. This :inline declaration allows + to avoid IFn's rules, because + disapp

Re: Can Clojure be as fast as Java?

2009-08-12 Thread Meikel Brandmeyer
Hi, On Aug 12, 11:54 am, Tayssir John Gabbour wrote: > On this topic, how do primitives work? I heard something about > "function boundaries." Which I interpret to mean that when a function > returns a primitive, Clojure boxes it in some Java object. And type > declarations can't stop this boxi

Re: Can Clojure be as fast as Java?

2009-08-12 Thread Tayssir John Gabbour
On this topic, how do primitives work? I heard something about "function boundaries." Which I interpret to mean that when a function returns a primitive, Clojure boxes it in some Java object. And type declarations can't stop this boxing from happening. Is this a correct understanding? (I doubt it

Re: Can Clojure be as fast as Java?

2009-08-12 Thread Nicolas Oury
Hello all, Just wanted to add a small remark. If you look at the shootout, most languages considered now to be very efficient has been once said to be very very slow and not usable. In the eighties, functional languages were doomed to be slow and unusable for anything. And Ocaml/MLton and the l

Re: Can Clojure be as fast as Java?

2009-08-11 Thread James Sofra
Hi fft1976, > If you use Java's arrays and declare all types, should Clojure be as > fast as the equivalent Java? So is the question you are trying to ask that since we have unwrapped access to Java is Java code written in Clojure as fast as if it were written as actual Java code? I guess tha

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Chad Harrington
On Tue, Aug 11, 2009 at 8:52 PM, Chouser wrote: > > I wonder if continued discussion on this thread will be > helpful to anyone. It seems to me we are not likely to soon > get any closer to an answer for the original question than > has already been offered. It's been lively and informative > b

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Chouser
I wonder if continued discussion on this thread will be helpful to anyone. It seems to me we are not likely to soon get any closer to an answer for the original question than has already been offered. It's been lively and informative but I hope it's run its course. --Chouser --~--~-~--

Re: Can Clojure be as fast as Java?

2009-08-11 Thread fft1976
On Aug 11, 7:39 pm, Chas Emerick wrote: > can to help -- but please don't assume that everyone else in the   > community shares your specific priorities. Why are you implying that that I assume that? You are replying to a message where I wrote that one should not assume others' priorities. --~

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Daniel
On Wed, Aug 12, 2009 at 8:02 AM, Luc Prefontaine wrote: > C++ has nothing to do with my previous statement. C++ is object oriented. > It's plagued with similar > problems than Java in terms of performance. > > I was talking about writing the machine code by hand, not relying on a > compiler's opti

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Chas Emerick
On Aug 11, 2009, at 8:19 PM, Daniel Lyons wrote: >> Perf bottlenecks are being addresses in Clojure already but not a >> the expense of expressiveness. >> And that is perfectly fine... > > > I agree completely with everything you're saying, and I too find > fft1976's obsession hard to relate

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Chas Emerick
On Aug 11, 2009, at 5:14 PM, fft1976 wrote: > On Aug 11, 1:50 pm, Stuart Sierra wrote: > >> I agree wholeheartedly. Let's optimize wherever possible, but drop >> on >> the side-by-side comparisons. > > I think it's very immature to dictate to others what should be > important to them. Speed m

Re: Can Clojure be as fast as Java?

2009-08-11 Thread fft1976
On Aug 11, 5:19 pm, Daniel Lyons wrote: > I agree with him that unadorned   > functional code should perform well Huh?! Andy, can you explain to him what needs to be explained? I'm all out of politeness for today. --~--~-~--~~~---~--~~ You received this message

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Luc Prefontaine
C++ has nothing to do with my previous statement. C++ is object oriented. It's plagued with similar problems than Java in terms of performance. I was talking about writing the machine code by hand, not relying on a compiler's optimizer to do so. C is a bit better than C++ but if you use a cross p

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Daniel Lyons
> Perf bottlenecks are being addresses in Clojure already but not a > the expense of expressiveness. > And that is perfectly fine... I agree completely with everything you're saying, and I too find fft1976's obsession hard to relate to. But I think that one problem with many modern language

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Daniel
On Wed, Aug 12, 2009 at 6:02 AM, Luc Prefontaine wrote: > > If your algorithm is single threaded and performance is a must then even > Java should be tossed away. > Any native machine code equivalent would be faster than Java... Pay attention when making assumptions: http://stackoverflow.com/ques

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Andy Fingerhut
On Aug 11, 4:27 pm, Stuart Halloway wrote: > If I am reading the README correctly, clj-8 is 10.8 times slower than   > Java, but clj-9 does better: 3.2 times slower. > > Stu You are reading that correctly. My clj-9 wasn't created until after fft1976's message starting this thread. Andy --~--~

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Stuart Halloway
If I am reading the README correctly, clj-8 is 10.8 times slower than Java, but clj-9 does better: 3.2 times slower. Stu > > I feel that this question is important enough to warrant its own > thread. > > If you use Java's arrays and declare all types, should Clojure be as > fast as the equival

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Luc Prefontaine
Ahem, does it have to be as fast as Java ? The way I see it, it's the same issue we dealt with languages like Fortran, Cobol, ... At some point, the only way to speed programs was to find hot spots and replaces these with faster code, mainly written in assembler or another language suited to the p

Re: Can Clojure be as fast as Java?

2009-08-11 Thread fft1976
On Aug 11, 2:24 pm, tmountain wrote: > Well, the question posed in the subject is whether Clojure can be as > fast as Java. The question was: "If you use Java's arrays and declare all types, should Clojure be as fast as the equivalent Java?" I'm sorry if the current subject line appears ambiguou

Re: Can Clojure be as fast as Java?

2009-08-11 Thread tmountain
Well, the question posed in the subject is whether Clojure can be as fast as Java. The answer to that question is yes. As with any generated code, there are many layers of optimization that could be performed. With Clojure being as young as it is, I doubt that generating isomorphic bytecode to tha

Re: Can Clojure be as fast as Java?

2009-08-11 Thread fft1976
On Aug 11, 1:50 pm, Stuart Sierra wrote: > > I agree wholeheartedly.  Let's optimize wherever possible, but drop on > the side-by-side comparisons. > I think it's very immature to dictate to others what should be important to them. Speed may be of minor concern to some Ruby-on-Rails types, but

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Stuart Sierra
On Aug 11, 4:35 pm, Chas Emerick wrote: > Maybe others will disagree, but I don't think that standard can ever   > be met.  There will always be tasks for which clojure is slower than   > java, just as there are tasks where java is slower than assembly. > > I suspect that those cases will become

Re: Can Clojure be as fast as Java?

2009-08-11 Thread Chas Emerick
On Aug 11, 2009, at 4:26 PM, fft1976 wrote: > I've seen that. There is a difference between "I can come up with two > snippets in Java and Clojure doing the same thing at the same speed" > and "For any Java code, I can write Clojure code that does exactly the > same thing just as fast". The diff

Re: Can Clojure be as fast as Java?

2009-08-11 Thread fft1976
On Aug 11, 1:09 pm, tmountain wrote: > Yes, Clojure can be just as fast as Java. Then why is Andy's code 10x slower? > There's an example on the > Clojure website that illustrates this. > http://clojure.org/java_interop I've seen that. There is a difference between "I can come up with two snip

Re: Can Clojure be as fast as Java?

2009-08-11 Thread tmountain
Yes, Clojure can be just as fast as Java. There's an example on the Clojure website that illustrates this. http://clojure.org/java_interop Rather than write this Java: static public float asum(float[] xs){ float ret = 0; for(int i = 0; i < xs.length; i++) ret += xs[i]; return ret; }

Re: Can Clojure be as fast as Java?

2009-08-11 Thread fft1976
On Aug 11, 12:02 pm, ataggart wrote: > On Aug 11, 11:55 am, fft1976 wrote: > > > I feel that this question is important enough to warrant its own > > thread. > > http://groups.google.com/group/clojure/search?group=clojure&q=%22as+f... > Sounds like you are saying that the consensus is "no", but

Re: Can Clojure be as fast as Java?

2009-08-11 Thread ataggart
On Aug 11, 11:55 am, fft1976 wrote: > I feel that this question is important enough to warrant its own > thread. http://groups.google.com/group/clojure/search?group=clojure&q=%22as+fast+as+java%22&qt_g=Search+this+group > > If you use Java's arrays and declare all types, should Clojure be as

Can Clojure be as fast as Java?

2009-08-11 Thread fft1976
I feel that this question is important enough to warrant its own thread. If you use Java's arrays and declare all types, should Clojure be as fast as the equivalent Java? I had taken this for granted, but empirical evidence indicates otherwise: Andy's version of the Nbody benchmark still appears