Old O'Reilly X books

Aaron Plattner aplattner at nvidia.com
Thu Aug 26 15:16:09 PDT 2010


On Thu, Aug 26, 2010 at 11:57:27AM -0700, Pat Kane wrote:
> On Thu, Aug 26, 2010 at 10:11 AM, Aaron Plattner <aplattner at nvidia.com> wrote:
> > On Thu, Aug 26, 2010 at 05:43:53AM -0700, Pat Kane wrote:
> >> BTW, while trying to grep my dead trees I noticed that the current X server
> >> contains some HAKMEM code, in ./mi/micmap.c I see this hack:
> >>     ...
> >>     count = (visuals >> 1) & 033333333333;
> >>     count = visuals - count - ((count >> 1) & 033333333333);
> >>     count = (((count + (count >> 3)) & 030707070707) % 077);  /* HAKMEM 169 */
> >>     ...
> >
> > Hah, awesome.
> >
> > Apparently that code sucked in 1995 and still sucks today:
> > http://compilers.iecc.com/comparch/article/95-07-080
> >
> > I increased the loop count by two orders of magnitude:
> >
> > NAIVE:    5.616 sec
> > HAKMEM:   7.541 sec
> > HAKMEM_P: 8.381 sec
>
> The XTS test suite has a bit count routine
> <http://cgit.freedesktop.org/xorg/test/xts/tree/xts5/src/lib/bitcount.c>
> that has a nice comment to explain what it is doing, could
> you bench mark it?

[code omitted]

5.414 sec


More information about the xorg-devel mailing list