Re: Alternative implementation of the generic __ffs
From: Joe Perches
Date: Sat Apr 19 2008 - 14:17:58 EST
On Sat, 2008-04-19 at 14:10 +0200, Alexander van Heukelum wrote:
> I've added that to the benchmark, which you can now find here:
> http://heukelum.fastmail.fm/ffs/.
retested on arm:
$ gcc -Os -fomit-frame-pointer ffs.c
$ ./a.out
Original: 3170 tics, 8326 tics
New: 4214 tics, 8793 tics
Smallest: 4023 tics, 7733 tics
Small const: 3442 tics, 6188 tics
Empty loop: 1517 tics, 2243 tics
$ gcc -O2 -fomit-frame-pointer ffs.c
$ ./a.out
Original: 3172 tics, 7832 tics
New: 4805 tics, 8790 tics
Smallest: 4405 tics, 7154 tics
Small const: 3442 tics, 5612 tics
Empty loop: 1516 tics, 2145 tics
$ gcc -O3 -fomit-frame-pointer ffs.c
$ ./a.out
Original: 3080 tics, 7709 tics
New: 4723 tics, 8656 tics
Smallest: 4333 tics, 7121 tics
Small const: 3379 tics, 5483 tics
Empty loop: 1447 tics, 2016 tics
> Testing the same with
> "return x4 + x3 + x2 + x1 + x0;" as the last line would be
> interesting too.
Adding is slower:
$ gcc -Os -fomit-frame-pointer ffs.c
$ ./a.out
Original: 3152 tics, 8310 tics
New: 4214 tics, 8789 tics
Smallest: 4024 tics, 7737 tics
Small const: 3538 tics, 6295 tics
Empty loop: 1517 tics, 2243 tics
$ gcc -O2 -fomit-frame-pointer ffs.c
$ ./a.out
Original: 3184 tics, 7849 tics
New: 4790 tics, 8814 tics
Smallest: 4406 tics, 7161 tics
Small const: 3538 tics, 5806 tics
Empty loop: 1521 tics, 2153 tics
$ gcc -O3 -fomit-frame-pointer ffs.c
$ ./a.out
Original: 3091 tics, 7694 tics
New: 4718 tics, 8656 tics
Smallest: 4333 tics, 7124 tics
Small const: 3467 tics, 5687 tics
Empty loop: 1445 tics, 2066 tics
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/