The changes are pretty substantial when you need them. I wrote a clojure implementation of Base64 that's faster than apache's commons-codec. In 1.2 it was about 5x slower.
Couldn't you speed up loops without annotations by compiling two versions: one that uses longs and one that uses bignums. You start in the loop that uses longs and before an operation that can overflow you check whether it overflows and if so you jump to the loop that uses bignums. This way you only suffer a few extra checks which is a lot cheaper than boxed numbers.
Bignums "contaminate" surrounding operations. Adding a long and a bignum yields a bignum. Seeding an equation with a single bignum (42N is a bignum representation of 42) will prevent overflow.
No one has come forward with a single real-world scenario where they're using bignums in Clojure. Choosing a default that is only theoretically useful rather than a 10x performance improvement seems a bit silly.
In any situation where the compiler cannot be sure you're using primitives everywhere, it will emit non-overflowing bytecode.
By my measure, there's nothing premature about this optimization. In Rich Hickey's words, Clojure is a replacement for Java, not Ruby. Giving up Java-like performance makes the language quantitatively less useful.
Premature? No people have been complaining (or just getting very confused) about Clojure's numeric performance without oodles of invasive type-hinting for two years now.
More importantly with these changes it's now possible to reimplement Clojure's core datastructures in Clojure without sacrificing performance.
The majority of people who care about BigInts are solving Project Euler problems, not writing Clojure libraries or deploying apps into production.
[+] [-] ataggart|15 years ago|reply
[+] [-] nickik|15 years ago|reply
[+] [-] jules|15 years ago|reply
[+] [-] SeanLuke|15 years ago|reply
[+] [-] fogus|15 years ago|reply
[+] [-] nickik|15 years ago|reply
The did it for a dacade and rich does it for a couple months and you bash him? We arn't the kawa guys faster after a decade.
Clojure is faster in other stoff like interop witch is really importend on the JVM. Can Kawa write down-to-java speed types?
[+] [-] d0m|15 years ago|reply
[+] [-] ataggart|15 years ago|reply
[+] [-] nickik|15 years ago|reply
The ^long thing is pretty cool bettr then : <long> or something. Its nice that it is just metadata.
[+] [-] rbanffy|15 years ago|reply
[+] [-] djacobs|15 years ago|reply
[+] [-] tvachon|15 years ago|reply
If I could do it again, I'd go with (inc clojure), as below.
[+] [-] nickik|15 years ago|reply
[+] [-] herdrick|15 years ago|reply
Oh no! Clojure is choosing the route of premature opt. What a terrible shame.
[+] [-] prospero|15 years ago|reply
Bignums "contaminate" surrounding operations. Adding a long and a bignum yields a bignum. Seeding an equation with a single bignum (42N is a bignum representation of 42) will prevent overflow.
No one has come forward with a single real-world scenario where they're using bignums in Clojure. Choosing a default that is only theoretically useful rather than a 10x performance improvement seems a bit silly.
In any situation where the compiler cannot be sure you're using primitives everywhere, it will emit non-overflowing bytecode.
By my measure, there's nothing premature about this optimization. In Rich Hickey's words, Clojure is a replacement for Java, not Ruby. Giving up Java-like performance makes the language quantitatively less useful.
[+] [-] swannodette|15 years ago|reply
More importantly with these changes it's now possible to reimplement Clojure's core datastructures in Clojure without sacrificing performance.
The majority of people who care about BigInts are solving Project Euler problems, not writing Clojure libraries or deploying apps into production.
[+] [-] peregrine|15 years ago|reply
[+] [-] c00p3r|15 years ago|reply