Message278485
On 64-bit Linux there's no difference:
$ ./usr/bin/gcc -O3 -o issue28397-2 issue28397-2.c
$ time ./issue28397-2 0
real 0m2.486s
user 0m2.424s
sys 0m0.014s
$ time ./issue28397-2 1
real 0m2.433s
user 0m2.422s
sys 0m0.008s
Also, most of the time "index < 0 || index >= nitems" *is* inlined,
and it was at least three times faster here.
I guess the general point is that such micro-optimizations are
unpredictable on modern architectures and modern compilers.
Note that the fast inlined version used SSE instructions. |
|
Date |
User |
Action |
Args |
2016-10-11 13:30:58 | skrah | set | recipients:
+ skrah, rhettinger, socketpair, serhiy.storchaka |
2016-10-11 13:30:58 | skrah | set | messageid: <1476192658.67.0.289705422722.issue28397@psf.upfronthosting.co.za> |
2016-10-11 13:30:58 | skrah | link | issue28397 messages |
2016-10-11 13:30:58 | skrah | create | |
|