Hmmm...

Looking at the code I see

(defn sum-trees [iterations depth]
  (let [sum #(+ (check-tree (make-tree % depth))
                      (check-tree (make-tree (- %) depth)))]
    (reduce + (map sum (range 1 (inc iterations))))))


Shouldn't expressing the algorithm as a REDUCE and MAP instead of a LOOP 
do the trick?  I would expect that to compile into parallel code.  
Otherwise, why go through all the pain of learning functional 
programming (and convincing management)?

Randall R Schulz wrote:
> On Sunday 07 December 2008 07:11, Peter Wolf wrote:
>   
>> I'm a n00b, but isn't the point of this language to be *faster* than
>> Java?... at least on a multiprocessor machine.
>>     
>
> I don't think performance is a particular criterion for the design of 
> this language. It's not unimportant, but the quality of the code it 
> engenders, especially w.r.t. to concurrency and the difficulty of 
> writing correct code using conventional thread-aware mechanisms,
> _is_ a key design goal.
>
>
>   
>> Shouldn't the number of processors on the test machine make a big
>> difference to how fast it runs?  Whereas, the Java version is only
>> dependent on the clock rate of the individual processors.
>>     
>
> Only for algorithms that are both parallelizable and which have actually 
> been written in parallel form. There is not yet (and may never be) any 
> ability to automatically parallelize arbitrary algorithms or code.
>
>
>   
>> What happens if we run this benchmark on a nice 4 core core machine?
>>     
>
> And nothing else is running? One core will be used for the thread 
> running this code. Another will do any I/O, though in this case there 
> is virtually none, and another will do GC.
>
> This test is a sequential algorithm. I'm not familiar with the Alioth 
> benchmarks / shootout, but maybe there are some parallel tests in 
> there.
>
>
> Randall Schulz
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to