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


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

Re: please coin a term for a lower order bug

From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: please coin a term for a lower order bug
Date 2012-01-10 22:11 -0800
Organization albasani.net
Message-ID <jej970$vt4$1@news.albasani.net> (permalink)
References <fqomg7ltgtddv3one61ei9c33755duu9ec@4ax.com> <2pboqbqz49.fsf@shell.xmission.com> <jehtqo$44n$1@dont-email.me> <jeiquf$7v0$2@news.albasani.net> <jf0qg7hhgusgc722kj9p85b43g0q3bvqlj@4ax.com>

Show all headers | View raw


Gene Wirchenko wrote:
> Lew wrote:
>> markspace wrote:
>>> Jim Janney wrote:
>>>> Roedy Green writes:
>>>>> What would you call a flaw in a program that had no effect on the
>>>>> results, but needlessly made the program slower or confusing?
>>
>> Slower _is_ an effect on results.
>>
>>>> What about one that makes it more confusing and needlessly faster?
>>>
>>> "Needlessly faster" as in the customer didn't need a speed improvement in that
>>> feature? I'd say that's Gold Plating.
>>>
>>> <http://en.wikipedia.org/wiki/Gold_plating_%28software_engineering%29>
>>
>> Only if it is superfluous code.  Some very relevant and proper code makes
>> things faster, such as use of a good algorithm.  It isn't necessarily gold
>> plating.
>
>       If the speed was not required and the change was made to increase
> the speed, then it is goldplating.

That's a good way to tell the difference.  We weren't talking about changes, 
we were talking about flaws, but regardless.  No one posited that the change 
was not required, nor that it was made for the purpose of increasing speed. 
It is quite possible to make a change that is required or has a functional 
purpose that also, and inevitably, makes the program faster.  Then it is not 
goldplating.

Applying your litmus test can tell the difference.

>       I often write code that is not optimal for speed, because it is
> easier to maintain.  If the code had to be faster, I would modify it.
> If it is fast enough, why bother?  There are enough other things to
> do.

Quite so.  But speed is not something to avoid, either, not if it is a byblow 
of better algorithm and smarter coding.  It is as dangerous a religion to shun 
speed in the name of not prematurely optimizing as it is to chase it prematurely.

There is also more than one metric of speed.  When you do optimize for speed, 
make sure it's the right kind.  I've seen performance choke on something sped 
up for the single-thread case when the target environment was heavily 
multithreaded.  Lock contention cascades non-linearly after a threshold. 
Individual service response time is not the same as system throughput.

Strangely (not), such premature optimizations were also horrid code with no 
functional purpose.  To call them gold-plating does them too much credit. 
More like poop plating.  A correct algorithm would have omitted the premature 
gold-, er, poop-plated monstrosity.  And been both easier to maintain and 
faster.  And used less memory.

Gene, I agree with your points.  But let us not swing too far the other way 
and eschew non-premature early optimization.  Correct logic more frequently 
than not creates maintainable, fast and memory-efficient code as an emergent 
consequence.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

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


Thread

please coin a term for a lower order bug Roedy Green <see_website@mindprod.com.invalid> - 2012-01-09 14:02 -0800
  Re: please coin a term for a lower order bug Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-01-09 14:18 -0800
    Re: please coin a term for a lower order bug bugbear <bugbear@trim_papermule.co.uk_trim> - 2012-01-10 09:18 +0000
    Re: please coin a term for a lower order bug George Neuner <gneuner2@comcast.net> - 2012-01-10 11:46 -0500
      Re: please coin a term for a lower order bug David Lamb <dalamb@cs.queensu.ca> - 2012-01-10 16:00 -0500
        Re: please coin a term for a lower order bug markspace <-@.> - 2012-01-10 13:38 -0800
          Re: please coin a term for a lower order bug Gene Wirchenko <genew@ocis.net> - 2012-01-10 15:14 -0800
      Re: please coin a term for a lower order bug Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-01-10 18:01 -0800
    Re: please coin a term for a lower order bug markspace <-@.> - 2012-01-10 08:52 -0800
      Re: please coin a term for a lower order bug Lew <noone@lewscanon.com> - 2012-01-10 17:52 -0800
        Re: please coin a term for a lower order bug Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-01-10 19:44 -0800
          Re: please coin a term for a lower order bug Gene Wirchenko <genew@ocis.net> - 2012-01-10 20:35 -0800
        Re: please coin a term for a lower order bug Roedy Green <see_website@mindprod.com.invalid> - 2012-01-11 10:54 -0800
  Re: please coin a term for a lower order bug Ian Pilcher <arequipeno@gmail.com> - 2012-01-09 17:29 -0600
  Re: please coin a term for a lower order bug Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-09 21:26 -0500
    Re: please coin a term for a lower order bug glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-01-10 02:43 +0000
      Re: please coin a term for a lower order bug Lew <noone@lewscanon.com> - 2012-01-10 07:01 -0800
        Re: please coin a term for a lower order bug Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-01-11 03:23 -0600
        Re: please coin a term for a lower order bug Wanja Gayk <brixomatic@yahoo.com> - 2012-01-15 13:21 +0100
          Re: please coin a term for a lower order bug Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-15 08:39 -0500
            Re: please coin a term for a lower order bug Patricia Shanahan <pats@acm.org> - 2012-01-15 06:39 -0800
    Re: please coin a term for a lower order bug Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-10 06:45 -0400
      Re: please coin a term for a lower order bug Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-10 07:54 -0500
        Re: please coin a term for a lower order bug Lew <noone@lewscanon.com> - 2012-01-10 07:13 -0800
        Re: please coin a term for a lower order bug Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-10 18:17 -0400
          Re: please coin a term for a lower order bug Gene Wirchenko <genew@ocis.net> - 2012-01-10 15:23 -0800
        Re: please coin a term for a lower order bug Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-01-11 03:30 -0600
          Re: please coin a term for a lower order bug Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-11 08:08 -0500
            Re: please coin a term for a lower order bug Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-01-11 14:38 -0600
              Re: please coin a term for a lower order bug Gene Wirchenko <genew@ocis.net> - 2012-01-11 15:48 -0800
      Re: please coin a term for a lower order bug Roedy Green <see_website@mindprod.com.invalid> - 2012-01-11 11:01 -0800
        Re: please coin a term for a lower order bug glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-01-12 01:45 +0000
          Re: please coin a term for a lower order bug Gene Wirchenko <genew@ocis.net> - 2012-01-11 18:05 -0800
  Re: please coin a term for a lower order bug Jim Janney <jjanney@shell.xmission.com> - 2012-01-10 09:52 -0700
    Re: please coin a term for a lower order bug markspace <-@.> - 2012-01-10 09:51 -0800
      Re: please coin a term for a lower order bug Lew <noone@lewscanon.com> - 2012-01-10 18:08 -0800
        Re: please coin a term for a lower order bug Gene Wirchenko <genew@ocis.net> - 2012-01-10 19:30 -0800
          Re: please coin a term for a lower order bug Lew <noone@lewscanon.com> - 2012-01-10 22:11 -0800
            Re: please coin a term for a lower order bug Gene Wirchenko <genew@ocis.net> - 2012-01-11 15:52 -0800
          Re: please coin a term for a lower order bug Jim Janney <jjanney@shell.xmission.com> - 2012-01-11 13:38 -0700
    Re: please coin a term for a lower order bug Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-10 14:05 -0500
  Re: please coin a term for a lower order bug v_borchert@despammed.com (Volker Borchert) - 2012-01-11 20:59 +0000
    Re: please coin a term for a lower order bug Gene Wirchenko <genew@ocis.net> - 2012-01-11 15:53 -0800
  Re: please coin a term for a lower order bug Fredrik Jonson <fredrik@jonson.org> - 2012-01-12 06:59 +0000
  Re: please coin a term for a lower order bug Wanja Gayk <brixomatic@yahoo.com> - 2012-01-15 12:45 +0100

csiph-web