Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36921

Re: A third easy performance optimisation needed

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: A third easy performance optimisation needed
Date 2017-07-13 19:39 -0400
Organization Aioe.org NNTP Server
Message-ID <ok90cc$1qc6$1@gioia.aioe.org> (permalink)
References <87d1946ab3.fsf@munus.decebal.nl> <ok7m1v$t5h$1@dont-email.me> <7cb2594a-bf4e-43bd-9d2b-20845b05b71e@googlegroups.com>

Show all headers | View raw


On 7/13/2017 8:48 AM, Eric Douglas wrote:
> On Thursday, July 13, 2017 at 7:41:39 AM UTC-4, Eric Sosman wrote:
>>       I'm not sure what you intend to say about `final', but I
>> hope you're familiar with Brian Goetz' thoughts on the matter:
>>
>> https://www.ibm.com/developerworks/java/library/j-jtp04223/index.html#N10087
>>
>> https://www.ibm.com/developerworks/java/library/j-jtp1029/index.html
> 
> So final classes and methods may not improve performance or definitely won't improve performance?

I think the conclusion is that there is no reason to expect a
performance improvement.

The actual performance may vary between Java vendor (Oracle, IBM,
Azul etc.), version and platform.

> Even if they do improve performance, if the improvement is insignificant it is a valid point
> you should not do it unless you definitely don't want the class extended or method overridden.
> Oracle does use it occasionally for that reason, notably in the String class.

There are good reasons to use final. Good reasons relating to the OO
design.

> So final variables don't affect performance either way?

Not sure. I am not a JVM expert like Goetz. My guess would be that
it is the same: no reason to expect a big performance difference,
but other reasons within design exist.

> I do use the Eclipse option to automatically declare variables
> final which are assigned exactly once.

That is an increasingly popular trend.

> These articles were written in 2002-3.  I wonder if it's all still relevant.

The JIT compilers optimizer has become even smarter than it was in 2003.

The smarter the optimizer is the dum,ber it is to try and manual
optimize the code.

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

A third easy performance optimisation needed Cecil Westerhof <Cecil@decebal.nl> - 2017-07-13 09:54 +0200
  Re:A third easy performance optimisation needed omegajunior <omegajunior@protonmail.com> - 2017-07-13 06:29 -0400
  Re: A third easy performance optimisation needed Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-13 11:27 +0000
  Re: A third easy performance optimisation needed Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-13 07:41 -0400
    Re: A third easy performance optimisation needed Eric Douglas <e.d.programmer@gmail.com> - 2017-07-13 05:48 -0700
      Re: A third easy performance optimisation needed Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 19:39 -0400
    Re: A third easy performance optimisation needed Cecil Westerhof <Cecil@decebal.nl> - 2017-07-13 15:14 +0200
      Re: A third easy performance optimisation needed Eric Douglas <e.d.programmer@gmail.com> - 2017-07-13 07:07 -0700
        Re: A third easy performance optimisation needed Robert Klemme <shortcutter@googlemail.com> - 2017-07-13 19:58 +0200
          Re: A third easy performance optimisation needed Cecil Westerhof <Cecil@decebal.nl> - 2017-07-13 20:02 +0200
  Re: A third easy performance optimisation needed Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 08:16 -0400
    Re: A third easy performance optimisation needed Eric Douglas <e.d.programmer@gmail.com> - 2017-07-13 06:08 -0700
      Re: A third easy performance optimisation needed Cecil Westerhof <Cecil@decebal.nl> - 2017-07-13 15:41 +0200
        Re: A third easy performance optimisation needed Eric Douglas <e.d.programmer@gmail.com> - 2017-07-13 07:09 -0700
          Re: A third easy performance optimisation needed Eric Douglas <e.d.programmer@gmail.com> - 2017-07-13 08:07 -0700
          Re: A third easy performance optimisation needed Cecil Westerhof <Cecil@decebal.nl> - 2017-07-13 18:37 +0200
        Re: A third easy performance optimisation needed Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2017-07-13 13:19 -0500
          Re: A third easy performance optimisation needed Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 14:32 -0400
      Re: A third easy performance optimisation needed Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 13:52 -0400
        Re: A third easy performance optimisation needed Eric Douglas <e.d.programmer@gmail.com> - 2017-07-14 07:52 -0700
  A third easy performance optimisation needed lewbloch@gmail.com - 2017-07-14 14:47 -0700

csiph-web