On Wed, Aug 21, 2013 at 07:04:58PM +0200, Stephen Röttger wrote:
>
> > What is performance impact for program that just qsorts big array? It
> > looks like worst case scenario for me.
>
> I just put together a quick test program that sorts an array of 10^6
> integers and stopped the execution time using "time". The results are as
> follows (+- 0,01s):
>
> protection disabled, -O0:
> ./sort_nofpp_0 0,19s user 0,02s system 98% cpu 0,215 total
>
> protection enabled, -O0
> ./sort_fpp_0 0,54s user 0,01s system 99% cpu 0,549 total
>
> protection disabled, -O3
> ./sort_nofpp_3 0,15s user 0,01s system 98% cpu 0,157 total
>
> protection enabled, -O3
> ./sort_fpp_3 0,51s user 0,00s system 99% cpu 0,511 total
>
> So this makes quite a difference:
> 0,19s -> 0,54s
> 0,15s -> 0,51s
After bit of thought a loops with callback can be optimized by gcc.
It could be possible to teach CSE to rewrite
while(foo){
check(p);
(*p)(x,y,z);
}
into
check(p);
while(foo){
(*p)(x,y,z);
}