On Fri, Feb 10, 2012 at 12:05 AM, Casper Bang <[email protected]> wrote: > Java is horribly stuck in legacy, it should've had a decimal (base 10) type > ages ago, but I digress. What I don't understand is, if Scala suffers from > runtime penalties approaching an order of magnitude for this simple problem, > under which conditions does it start to pay off automagically? Perhaps the > culprit here is that Fibonacci is inherently a linear/serial problem, so > prime number factorization might be a better example?!
I think in this case the benefit of Scala is if you try and add a few zeros to the max number you are looking at more than it is performance. Changing the Scala code to work on BigInt level values is trivial. Changing the Java is a pain in the neck. (Not impossible, by any measure, just annoying.) Also, I'm not entirely sure what you are aiming for in this. The speed of both of these solutions is quite nice, by any measure. If you are doing any "non-trivial" application you are most likely hitting other bottlenecks than number crunching ability. -- You received this message because you are subscribed to the Google Groups "The Java Posse" 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/javaposse?hl=en.
