After seeing this issue, I brought it up in #clojure.  After
experimenting with it in both 1376 and earlier, it seems that the same
behaviour for stuff like (/ (int 1) (int 2)) exist, where it is about
5 times slower than (/ 1 2), which is kind of a strange result.

The solution is to create a method in Number.java that accepts two
ints as arguments.  Right now there is a method with (int Object) and
(Object int), but not (int int).  While we are at it, we should
probably create the same method for other numeric types.  Just like
the other methods that call divide by changing the primitive to an
object and calling divide on the two, just make a call to divide with
both of them being objects, and you will get the same performance
without the reflection.  I would post the code, but I don't have a CA
turned in.

On May 28, 3:03 pm, kotor <[email protected]> wrote:
> After updating to r1381, the following code produces a "reflection
> warning - call to divide can't be resolved" on the last line. This
> warning did not occur at r1376 or earlier.
>
> (defn prime-frequency [x y]
> "integer integer -> real. frequency of primes in range"
>   (let [xy (range x y)]
>     (/ (count (filter prime? xy)) (count xy))))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to [email protected]
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