Re: Alternative implementation of the generic __ffs

From: Alexander van Heukelum
Date: Sat Apr 19 2008 - 16:27:03 EST


On Sat, 19 Apr 2008 11:17:01 -0700, "Joe Perches" <joe@xxxxxxxxxxx>
said:
> 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/.

Thanks! Added the version you sent to the program and added the results
of the ARM processor to the page.

More ideas welcome ;).

> 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
>
>
--
Alexander van Heukelum
heukelum@xxxxxxxxxxx

--
http://www.fastmail.fm - And now for something completely different?

--
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/