octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48750] java interface: performance of wrappin


From: Ernst Reissner
Subject: [Octave-bug-tracker] [bug #48750] java interface: performance of wrapping fundamental scalar types
Date: Wed, 10 Aug 2016 15:15:45 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0

Follow-up Comment #2, bug #48750 (project octave):

Yes, first sentence is correct. 
Second one I wonder because I read: 


ublic static Integer valueOf(int i)

Returns an Integer instance representing the specified int value. If a new
Integer instance is not required, this method should generally be used in
preference to the constructor Integer(int), as this method is likely to yield
significantly better space and time performance by caching frequently
requested values. This method will always cache values in the range -128 to
127, inclusive, and may cache other values outside of this range.

Parameters:
    i - an int value.
Returns:
    an Integer instance representing i.
Since:
    1.5 


meaning that numbers in range -127,128 are cached always, 
i.e. never lead to object creation when invoked in that range. 
The should sentence means that normally, 
a new object is created only if an equivalent one is not yet cached. 

See also 

http://stackoverflow.com/questions/2974561/new-integer-vs-valueof

on boxing with reference to jls specification. 
There explicitly equality of two integers means that they are the same. 
Normally, valueOf is what is used for boxing/unboxing. 

By the way, here we see, that we shall not talk about boxing 
when we just mean conversion java-octave. 



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48750>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]