> <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).
>> 
>> It will make sense once you understand
> 
> I don't care for your condescending tone.

I apologize. This forum is renowned for civil discourse, and I hope it will 
continue to be.

> Now, as I understand it, + and the like, being normal Clojure
> functions (rather than, say, special forms or interop calls), take and
> return boxed values.

I think I can help here:

1. Clojure's numeric operators are more than normal Clojure functions. You can 
see hints of this in the source code (even in 1.2!) in the :inline and 
:inline-arities metadata. 

2. As such, Clojure's numeric operators are capable of working directly with 
primitives. 

3. In 1.3 functions can take and return primitives.

It is the combination of these factors that provides the speed boost in 1.3, so 
if you were unaware of some of them, perhaps we have been talking past each 
other.

Stu 



-- 
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

Reply via email to