On Thu, Dec 16, 2010 at 8:13 AM, Stuart Halloway <stuart.hallo...@gmail.com> wrote: >> Worse, from the sounds of it the new + isn't exactly the old >> unchecked-+; it still checks for overflow rather than allowing >> wrapping. That's going to add a compare-and-branch to every add >> instruction and halve the speed of those operators on typical >> hardware. Compare-and-throw-exception is hardly superior to >> compare-and-box-in-BigInteger, since it's still slow AND now some >> arithmetic code that used to work but be slow will now explode in your >> face. > > This argument is based on the (provably wrong) presumption that "still slow" > means "equally slow". The difference is percentage points vs. order of > magnitude. Test it for yourself.
That does not make sense, since the implementations in both cases have to test for overflow and branch. In the "overflowed" branch further expensive actions are taken -- in both cases the creation of a Java object, for instance (an exception or a boxed numeric). These branches might differ in other ways in speed, but they're the rare case. The common case is test and accept the result, returning it, in both cases; so the common case should have comparable execution speed given both implementations. If not, something is wrong someplace else with at least one of the implementations (or, much less likely, with the JVM/JIT). > Until that is done, if you want to continue this thread, please make > arguments that back up notions like "slow" or "fast" or "broken" with > evidence from real code. As for "broken", you can't honestly think changing the semantics of the + operator, after years of code written in Clojure has accumulated, won't break *something*. Surely. Most likely many somethings, scattered all over the place. -- 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