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


Groups > comp.lang.c > #26713

Re: Swapping logic

From Gareth Owen <gwowen@gmail.com>
Newsgroups comp.lang.c
Subject Re: Swapping logic
References (1 earlier) <k3ndov$832$1@dont-email.me> <k3njsc$gjs$1@dont-email.me> <slrn3vfsk65443.b0j.andrews@sdf.lonestar.org> <87ehlpnxot.fsf@gmail.com> <YsGdnYAVmcHbA__NnZ2dnUVZ7vGdnZ2d@lyse.net>
Date 2012-09-26 17:51 +0100
Message-ID <87y5jwlocc.fsf@gmail.com> (permalink)

Show all headers | View raw


David Brown <david@westcontrol.removethisbit.com> writes:

> When you have particular specialised needs, you have to work very
> closely with the compiler - playing with command line switches and
> code layout, and analysing the exact generated assembly code.  For
> small embedded systems, or very time-critical code, many rules no
> longer apply

Right.  I agree completely. When Eric said "Don't do this", he
implicitly meant "Don't do this unless you really, really know why you".

Writing fancy-dan XOR exchange routines without first proving they're
necessary is classic premature optimisation, and we all know what
premature optimisation is.

> But for general programming - as done by the majority of programmers
> for the majority of the time - rules like this apply.  

Right. I agree completely. 

<RANT type=OT>

(And I speak as someone who's spent the day
trying to squeeze individual clock cycles out of an ARM7 routine because
the proprietary compiler does not optimise well -- the kind of day when
you're profiling branch probabilities to determine which branch is the
hot path, but have no way to communicate this to the compiler, which has
decided that no matter what you it's going to guess wrong :( ).  

I  freaking hate *compiler name elided*
</RANT>

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


Thread

Swapping logic ZUBAIR TRALI <bhat.zubair789@gmail.com> - 2012-09-23 05:48 -0700
  Re: Swapping logic Richard Damon <news.x.richarddamon@xoxy.net> - 2012-09-23 09:04 -0400
  Re: Swapping logic Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-23 09:15 -0400
    Re: Swapping logic Noob <root@127.0.0.1> - 2012-09-24 12:56 +0200
  Re: Swapping logic Casey Carter <Casey_at_Carter_dot_net@dontspam.me.invalid> - 2012-09-23 11:35 -0500
    Re: Swapping logic Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-23 14:19 -0400
      Re: Swapping logic Nobody <nobody@nowhere.com> - 2012-09-24 10:57 +0100
      Re: Swapping logic Andrew Smallshaw <andrews@sdf.lonestar.org> - 2012-09-26 05:20 +0000
        Re: Swapping logic Gareth Owen <gwowen@gmail.com> - 2012-09-26 06:46 +0100
          Re: Swapping logic David Brown <david@westcontrol.removethisbit.com> - 2012-09-26 08:16 +0200
            Re: Swapping logic Gareth Owen <gwowen@gmail.com> - 2012-09-26 17:51 +0100
  Re: Swapping logic Kaz Kylheku <kaz@kylheku.com> - 2012-09-23 18:19 +0000

csiph-web