Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Cecil Westerhof Newsgroups: comp.lang.java.programmer Subject: Re: A third easy performance optimisation needed Date: Thu, 13 Jul 2017 15:41:53 +0200 Organization: Decebal Computing Lines: 36 Message-ID: <87pod44foe.fsf@munus.decebal.nl> References: <87d1946ab3.fsf@munus.decebal.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="cea988b749795bfe5e66959d383985c6"; logging-data="22604"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PENsfiLsceCbOSR1L7y4SLiiwr/O69CY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:bTibv4eT4/hjfy/Zl/CORE0sK1g= sha1:IlGCxG4kP7VjphEN/iU+g+i/Csk= X-Homepage: http://www.decebal.nl/ Xref: csiph.com comp.lang.java.programmer:36889 Eric Douglas writes: > On Thursday, July 13, 2017 at 8:16:38 AM UTC-4, Arne Vajhøj wrote: >> >> Drop the two items you already have?? >> >> :-) >> >> Seriously I don't think using final and avoiding auto-boxing >> are good performance topics. >> >> I would not expect any impact in overall performance of real world >> applications. >> >> Arne > > Since my compiler doesn't warn, I don't pay much attention to implicit > autoboxing. I don't know why anyone would do unnecessary explicit > autoboxing. I'd like to see a real world sample showing notable > performance improvement by going out of your way to avoid autoboxing. > Often using it does at least make code more readable. Look at the example at: https://github.com/CecilWesterhof/JavaExamples/blob/master/BoxedTest.java And it also shows that using a long where an integer is sufficient it can have a gigantic difference. On my system the long/integer (which already takes a third less time in the first run) is after 5 runs about 2½ million times faster as after the first run, while the long/long part is not optimised. See my reply in: One code is aggressively optimised, while another not. Why? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof