On 30 November 2010 16:02, Jochen Theodorou <[email protected]> wrote:

> [email protected] wrote:
> [...]
>
>  Is it, what you propose that the JVM replaces iadd instructions (et
>> al) with the resp. bytecodes to extract the primitive integer value
>> and apply the operation on that value? How would that improve
>> performance? I can think of two possible explanations for bad
>> performance with boxed primitives: 1. added redirection. 2. allocation
>> costs. How would you make that go away?
>>
>
> Does the JVM even has to realize an int object before something specific to
> the object is done? I think not. I think that in many cases the JVM does not
> have to create an actual Integer and thus does not have to pay the cost of
> creating the actual object. About bad performance...
> The problem is that either I handle Integer, then for a Integer+Integer I
> have to unbox both and most probably also box again. Or I handle int, and
> then I have to live with the problems regarding for example assigning null.
>
>
But what of a collection of integers, or any other generic type for that
matter?  Places where you simply can't use a primitive.

This is where the most pain is felt.  Micro-optimising a single integer
addition is silly, but when you have 10,000 of them... and no, arrays are
NOT the answer.

-- 
Kevin Wright

mail / gtalk / msn : [email protected]
pulse / skype: kev.lee.wright
twitter: @thecoda

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" 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/jvm-languages?hl=en.

Reply via email to