comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-dejanews.com>
Subject: Re: scope and/or parameters (beginner)
Date: 1999/04/15
Date: 1999-04-15T00:00:00+00:00	[thread overview]
Message-ID: <7f51kt$m3u$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 7f46ij$vfo$1@nnrp1.dejanews.com

In article <7f46ij$vfo$1@nnrp1.dejanews.com>,
  czgrr <czgrr@my-dejanews.com> wrote:
> Ever since then, when I have the same sort of situation
> with very large arrays,
> etc, I always make them global. It is less logically
> correct, yes, it may not be necessary *in that
> environment*, yes, but it had fixed a bug and I learned
> from it.

You learned that a kludge that you did not understand
fixed a particular problem in a particular environment
for reasons that were unclear. Still if you have to kludge
to get something working, sometimes you have to (though
I would have investigated why this had the effect that
it did, you might have found for instance, that this
particular change by complete accident removed an Icache
conflict in a completely unrelated part of the program).

In the GNAT project, if we have to put in kludges of this
kind, we mark them with ??? which is a reminder to fix
them properly some time when we can figure out the proper
fix, or better understand the situation.

What you did wrong was to extend this observation in a way
completely unjustified by the observation, and then put a
nasty kludge in other programs, one which most certainly
may damage the structure (e.g. making things task unsafe
when they would otherwise be safe), and indeed likely
slowing down things.

When you make a change to your program that speeds things
up, you should not conclude ANYTHING unless you understand
WHY it sped things up.

Remember that this thread started with your completely
unjustified (and as it turns out unjustifiable) general
statement that global arrays were more efficient than
local arrays.

An equally valid statement would have been to note that
moving a declaration from line 345 to line 123 of the unit
fixed the efficiency problem, and then deciding that in
all units from now on, you will avoid the horribly
innefficient results of putting any declarations in line
345 of any unit.

Now, that's absurd, and you know enough to know it's
absurd, so you avoid this mistake. Well the conclusion
you drew is also absurd, you just don't know enough to
*know* that it is!

I will repeat, in my experience, the rumours and supposed
knowledge that many programmers have about what is and
what is not efficient are often vague, confused, or plain
wrong, and frequently result in contaminated less
maintainable code, and in many cases actually slow down
processing (as would the practice of making arrays global
on most machines).

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-04-15  0:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-02  0:00 scope and/or parameters (beginner) fluffy_pink
1999-04-03  0:00 ` Matthew Heaney
1999-04-05  0:00 ` Corey Ashford
1999-04-05  0:00   ` fluffy_doo
1999-04-06  0:00     ` Matthew Heaney
1999-04-08  0:00     ` czgrr
1999-04-10  0:00       ` fluffy_puff
1999-04-12  0:00       ` dennison
1999-04-13  0:00         ` Robert Dewar
1999-04-13  0:00         ` czgrr
1999-04-13  0:00           ` Robert Dewar
1999-04-14  0:00             ` czgrr
1999-04-14  0:00               ` dennison
1999-04-14  0:00               ` Robert Dewar
1999-04-15  0:00                 ` czgrr
1999-04-15  0:00                   ` Robert Dewar [this message]
1999-04-13  0:00     ` Robert A Duff
1999-04-14  0:00       ` Robert Dewar
1999-04-14  0:00         ` Hyman Rosen
1999-04-14  0:00           ` dennison
1999-04-14  0:00             ` Hyman Rosen
1999-04-14  0:00               ` dennison
1999-04-14  0:00                 ` Hyman Rosen
1999-04-15  0:00                   ` dennison
1999-04-15  0:00                     ` Robert Dewar
1999-04-15  0:00                       ` Hyman Rosen
1999-04-15  0:00                       ` dennison
1999-04-15  0:00           ` Robert Dewar
1999-04-15  0:00             ` Hyman Rosen
1999-04-15  0:00               ` Robert Dewar
1999-04-15  0:00                 ` Hyman Rosen
1999-04-16  0:00               ` Rakesh Malhotra
1999-04-15  0:00       ` fluffy_dong
1999-04-15  0:00         ` Robert Dewar
1999-04-15  0:00           ` dennison
1999-04-15  0:00             ` fluffy_dong
1999-04-16  0:00               ` Robert Dewar
1999-04-16  0:00                 ` Fraser Wilson
1999-04-16  0:00                   ` Gautier.DeMontmollin
1999-04-20  0:00                     ` Nick Roberts
1999-04-21  0:00                     ` fraser
1999-04-22  0:00               ` Robert A Duff
1999-04-22  0:00                 ` Larry Kilgallen
1999-04-16  0:00         ` Samuel Mize
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox