Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Autoboxing and Performance ? Date: Thu, 22 Aug 2013 09:49:49 +0200 Organization: albasani.net Lines: 47 Message-ID: References: <52154afc$0$302$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.albasani.net M05Mv9lIkSvhWGnuth+f6QT21ZXWYc4bWegtz6YsbxGTXJqeOZ5A2SIYPwPLmXv0NKgl9jWOrm3yiea6TLRI7g== NNTP-Posting-Date: Thu, 22 Aug 2013 07:49:44 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="hfHvQdFwXlIduSB8Q4YBB4FplA5YkX20xbf8jX91pKSar36mw4CJKMBryz/AhySsDot6L15LTMoNoSHyrIjzgc5D0onFnW5p69qoh44JUFNZ0LybwGAKPtjRS0rLtSIk"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0 SeaMonkey/2.20 In-Reply-To: <52154afc$0$302$14726298@news.sunsite.dk> Cancel-Lock: sha1:GcXKZmOLyYfluwC8JAsWMOshC5w= Xref: csiph.com comp.lang.java.programmer:25105 Arne Vajhøj schrieb: > He made some comments to you that explained that you > you had forgotten about the escape analysis > capability in your explanation. It seems to me that Lew has sometimes no clue what he is writing about. For example I wrote: > Most probably the generated code for unboxing/boxing will > use Integer.intValue() to access the value and Integer.valueOf() > to create a new object. Which refers to Java byte code generation. Then Lew wrote: > Assuming HotSpot doesn't entirely optimize away the object references. Which refers to code generate by the JVM from the given Java byte code. So I didn't say something wrong. Then Lew wrote: > It is very dangerous to make performance claims about > Java based on _a priori_ reasoning. I could ask him the same about his Hotspot escape analysis claim. Where is HIS evidence? Under what load? What percentage of code is subject to the Hotspot escape analysis? Etc.. Since the OPs code is main() and not some heavily used loop, most likely no Hotspot compilation will kick in at all. So most likely the code will be executed as I described it: > In your present case thus, already for 99 an object from the > cache is fetched, and then for 100 also an object from the cache > is fetched, thus not involving any single heap allocation. I am willingly to retract my claim if some counter evidence can be provided. Bye