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


Groups > comp.compilers > #2202

Re: Optimization techniques

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.compilers
Subject Re: Optimization techniques
Date 2019-04-23 09:43 +0200
Organization A noiseless patient Spider
Message-ID <19-04-018@comp.compilers> (permalink)
References <19-04-004@comp.compilers> <19-04-012@comp.compilers>

Show all headers | View raw


On 20/04/2019 00:27, Hans-Peter Diettrich wrote:
> Am 17.04.2019 um 15:42 schrieb Rick C. Hodgin:
>> Are there resources someone can point me to for learning more about
>> time-honored, long-established, safely applied, optimization
>> techniques for a C/C++ like language?
>
> I'm always a bit sceptic when C/C++ and "safe" occur in the same
> sentence.

C and C++ can certainly be used safely.  But the programmer needs to
know what they are doing, and want to write safe code.

> AFAIR a C compiler is allowed to ignore parentheses when
> reordering expressions, what can lead to numeric instabilities.

For floating point operations, such re-arrangements could lead to
numeric instabilities - and they are not allowed.

For signed integer operations, brackets that affect calculations can't
be removed.  The compiler can't change "(a * b) / c" into "a * (b / c)".
 But mathematical identities such as associativity and commutativity are
valid because signed integer overflow does not happen - thus "a * (b +
c)" can be changed to "(a * b) + (a * c)".

And of course the evaluation of sub-expressions can be done in any order.

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Optimization techniques "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-17 09:42 -0400
  Re: Optimization techniques Hans Aberg <haberg-news@telia.com> - 2019-04-17 18:11 +0200
  Re: Optimization techniques George Neuner <gneuner2@comcast.net> - 2019-04-18 04:07 -0400
    Re: Optimization techniques "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-18 11:22 -0400
      Re: Optimization techniques George Neuner <gneuner2@comcast.net> - 2019-04-19 15:48 -0400
    Re: Optimization techniques Hans Aberg <haberg-news@telia.com> - 2019-04-19 00:52 +0200
  Re: Optimization techniques Kaz Kylheku <847-115-0292@kylheku.com> - 2019-04-19 08:49 +0000
    Re: Optimization techniques "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-19 11:48 -0400
      Re: Optimization techniques David Brown <david.brown@hesbynett.no> - 2019-04-23 09:38 +0200
    Re: Optimization techniques David Brown <david.brown@hesbynett.no> - 2019-04-23 09:18 +0200
  Re: Optimization techniques Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-04-20 00:27 +0200
    Re: Optimization techniques "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-19 16:11 -0700
      Re: Optimization techniques Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2019-04-20 19:47 +0200
        Re: Optimization techniques "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2019-04-24 10:16 -0400
    Re: Optimization techniques George Neuner <gneuner2@comcast.net> - 2019-04-20 18:59 -0400
    Re: Optimization techniques David Brown <david.brown@hesbynett.no> - 2019-04-23 09:43 +0200
      Re: Optimization techniques Martin Ward <martin@gkc.org.uk> - 2019-04-26 20:10 +0100
        Re: Optimization techniques Kaz Kylheku <847-115-0292@kylheku.com> - 2019-04-26 21:11 +0000
        Re: Optimization techniques David Brown <david.brown@hesbynett.no> - 2019-04-28 17:22 +0200
          Re: Optimization techniques Gene Wirchenko <genew@telus.net> - 2019-04-30 18:07 -0700
            Re: Optimization techniques David Brown <david.brown@hesbynett.no> - 2019-05-01 09:03 +0200
    Re: Optimization techniques "Derek M. Jones" <derek@_NOSPAM_knosof.co.uk> - 2019-04-26 13:39 +0100
  Re: Optimization techniques rockbrentwood@gmail.com - 2019-09-26 20:35 -0700

csiph-web