[isabelle] 64-bit Java is 6x faster than 32-bit for a recursive fibonacci



Hi,

I saw 64-bit Cygwin talked about, so I send this in to show that 64-bit Java for Cygwin would be beneficial for some things.

Basically, I've been testing a lot of different languages for a recursive fibonacci function of this form, for a input value of 42:

fun fib (n:int) = (if (n < 2) then n else (fib(n - 1) + fib(n - 2)));

What I can say is that Scala is fast, and most everything else is slow in comparison to it, though several things have to be taken into consideration, such as whether a language needs to be compile, and whether the integers are machine integers or big integers.

The crux of this email is that for Clojure, for 32-bit Java under Cygwin or Windows, takes about 48 seconds for fib(42), where for 64-bit Java, it's about 8 seconds, which is actually not that bad compared to other languages.

For Isabelle/ML, fib(42) is about 4.3 seconds, though it's using big integers.

For Scala, it's about 2.7 seconds, and the version of Java doesn't make much difference.

For compiled Haskell, it's about 37 seconds.

For compiled Erlang, it's about 16 seconds for a pattern matched form of fib, and 36 seconds for the if/then form.

For Julia, which is supposed to be fast, it was about 5 seconds.

For Mirah, which has syntax like Ruby, but is just a frontend on Java, it was a little slower than Scala.

I saw Lisp SBCL, but I don't know how to compile a lisp program with it, but http://benchmarksgame.alioth.debian.org shows that it should be about as fast as Scala.

Many of these numbers look somewhat like what the benchmarks site shows, other than Haskell.

I've seen a pattern emerging for me: define a datatype, then define a fun using recursion and pattern matching for the datatype, and then do a few calculations with the fun before proving anything.

Up front, I want to know if it works, and also I'd like to know if it's a major loser as far as speed. A language doesn't have to be the fastest to test that out, but if it's dramatically slower than Scala, then that's a bad road to start down.

I've gotten the reject twice by the mail server, first because the attachment was too big, and the second, with a smaller attachment, probably because of the first reject. I guess Gmx is used a lot for spam. I'll see how this one goes, but it's worth a try to put some exposure on the possibility of 64-bit Cygwin being used. I might be auto-banned by the auto-spam-filter-bot, which wouldn't be a bad thing.

Regards,
GB




This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.