Re: Confusing optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Luca Béla Palkovics" <luca.bela.palkovics@xxxxxxxxx> writes:

> Is this normal ? b has nothing todo with a .. why does a get slower ?
> (b is also faster without a...)

There are a number of possibilities.  It's hard to know what is
happening without an exact test case.  You also neglected to say what
platform you are running on.

Some possibilities are:

1) Measurement error.  Surprisingly often people are not measuring
   what they think they are measuring, and you didn't provide any
   details about how you got your timings.

2) Instruction cache effects, if a() and b() call other functions.
   When both are linked together, those other functions will be at
   different addresses, and whether they are contiguous may change,
   all affecting the instruction cache.

3) Exact aligment of loop starts may shift when both are linked
   together, affecting the processor's branch optimizers if it has
   any.  Similarly, the exact alignment of labels may shift.  You can
   control these using gcc options like -falign-functions,
   -falign-jumps, -falign-labels, -falign-loops.

There are other, less likely, possibilities.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux