Hi Jonathan, I provided the Clojure pull request btw. I think Rob's explanation is correct.
Alex On Tuesday, February 25, 2014 7:20:46 AM UTC-6, Rob Day wrote: > > It looks like an improvement in clojure.lang.BigInt over > java.math.BigInteger - BigInt's add() method seems to do a long + long > add if it doesn't overflow > ( > https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/BigInt.java#L142) > > > and only fall back to BigInteger's add method (which has no such > optimisation - > http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/math/BigInteger.java#BigInteger.add%28java.math.BigInteger%29) > > > if the overhead of BigInteger is actually needed. > > If you use clojure.lang.BigInt in your Java code, I suspect Java will be > faster. > > On 25 February 2014 10:38, Jonathan Barnard > <jonathan....@gmail.com <javascript:>> wrote: > > I recently did a benchmark (admittedly in hindsight not a particularly > good > > one) that involved comparison of an implementation of the same small > program > > in Java and in Clojure, in which most of the time is spent in bignum > > operations. The results are at this link (the tables at the top; ignore > the > > rest). The Clojure implementation appears to consistently perform better > > than the Java implementation (at least on this setup, x86-64 Linux with > > OpenJDK 1.7.0_25). I'd be interested to learn what Clojure does to make > it > > perform faster than Java in this case, so I thought here might be a good > > place to ask. > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clo...@googlegroups.com<javascript:> > > Note that posts from new members are moderated - please be patient with > your > > first post. > > To unsubscribe from this group, send email to > > clojure+u...@googlegroups.com <javascript:> > > For more options, visit this group at > > http://groups.google.com/group/clojure?hl=en > > --- > > You received this message because you are subscribed to the Google > Groups > > "Clojure" group. > > To unsubscribe from this group and stop receiving emails from it, send > an > > email to clojure+u...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > -- > Robert K. Day > rober...@merton.oxon.org <javascript:> > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.