git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH JGIT] Method invokes inefficient Number constructor; use static valueOf instead

From
Shawn O. Pearce <spearce@spearce.org>
Date
Apr 27, 2009, 23:15 UTC
Message-ID
<20090427231550.GK23604@spearce.org>
In-Reply-To
<366BBB1215D0AB4B8A153AF047A2878002FCE7E9@dewdfe18.wdf.sap.corp>
"Sohn, Matthias" <matthias.sohn@sap.com> wrote:
> Using new Integer(int) is guaranteed to always result in a new object
> whereas Integer.valueOf(int) allows caching of values
> to be done by the compiler, class library, or JVM. Using of cached
> values avoids object allocation and the code will be faster.
NAK.
This thread came up about 5 weeks ago.  Please see my reply here:
  http://thread.gmane.org/gmane.comp.version-control.git/113738/focus=113785
 
-- 
Shawn.
Previous: Sohn, MatthiasNext: Shawn O. Pearce
Message 7 of 9 in “Computation of average could overflow”
  1. Computation of average could overflowSohn, Matthias, Apr 27, 2009
  2. Method invokes inefficient new String(String) constructorSohn, Matthias, Apr 27, 2009
  3. Method invokes inefficient Number constructor; use static valueOf insteadSohn, Matthias, Apr 27, 2009
  4. Method ignores results of InputStream.skip()Sohn, Matthias, Apr 27, 2009
  5. Shawn O. PearceApr 27, 2009
  6. Method ignores results of InputStream.skip()Sohn, Matthias, Apr 28, 2009
  7. Shawn O. PearceApr 27, 2009
  8. Shawn O. PearceApr 27, 2009
  9. Shawn O. PearceApr 27, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.