see 
https://github.com/clojure/test.benchmark/blob/master/src/main/clojure/alioth/mandelbrot.clj#L49

There's two ways to get rid of the reflection warning:
1) another function, appropriately type hinted
2) explicit conversion to long

According to my measurements for this particular case, option 2 is 
fractionally faster by ~3% over option 1.
Expectation would be the explicit conversion to long shouldn't be needed.

On Thursday, September 15, 2011 8:16:10 PM UTC-7, pmbauer wrote:
>
> I ran into this exact issue on an alioth benchmark.
> Adding the explicit (long ...) conversion gets rid of the reflection 
> warning, but didn't have a significant effect on performance.
> The inner loop is still boxing the return value.
>
> On Thursday, September 15, 2011 8:36:53 AM UTC-7, Sean Corfield wrote:
>>
>> On Thu, Sep 15, 2011 at 7:50 AM, David Nolen <dnol...@gmail.com> wrote:
>> > Loop itself will return boxed values I think.
>>
>> Looks that way. The following code has no reflection warning:
>>
>> (loop [x 1 changed 0]
>>  (if (= x 10)
>>    changed
>>    (recur (inc x)
>>           (long (loop [y 1 changed-y changed]
>>                   changed-y)))))
>> -- 
>> Sean A Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>> World Singles, LLC. -- http://worldsingles.com/
>> Railo Technologies, Inc. -- http://www.getrailo.com/
>>
>> "Perfection is the enemy of the good."
>> -- Gustave Flaubert, French realist novelist (1821-1880)
>>
>>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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

Reply via email to