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
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 w
On Thu, Sep 15, 2011 at 10:50 AM, David Nolen wrote:
> On Thu, Sep 15, 2011 at 3:18 AM, Sergey Didenko
> wrote:
>> Auto-boxing loop arg: change"
>>
>> (loop [x 1 changed 0]
>> (if (= x 10)
>> changed
>> (recur (inc x)
>> (loop [y 1 changed-y changed]
>> changed-y
Thanks!
Though it is not obvious IMHO.
> (loop [x 1 changed 0]
> (if (= x 10)
> changed
> (recur (inc x)
> (long (loop [y 1 changed-y changed]
> changed-y)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to
On Thu, Sep 15, 2011 at 7:50 AM, David Nolen 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]
chang
On Thu, Sep 15, 2011 at 3:18 AM, Sergey Didenko wrote:
> Hi,
>
> Is it a bug or I'm doing something wrong? I can't get rid of
> auto-boxing in the second example, neither by type hinting nor by type
> coercing of "changed*" locals.
>
> (set! *warn-on-reflection* true)
>
> This compiles fine:
>
> (
Hi,
Is it a bug or I'm doing something wrong? I can't get rid of
auto-boxing in the second example, neither by type hinting nor by type
coercing of "changed*" locals.
(set! *warn-on-reflection* true)
This compiles fine:
(loop [x 1 changed 0]
(if (= x 10)
changed
(recur (inc x)