Question about BITSET_WORD

Faith Ekstrand faith at gfxstrand.net
Wed Aug 21 13:54:25 UTC 2024


I've actually benchmarked this and 32bit is still faster on many modern
CPUs.

Also, I would be very surprised if we could change it without breaking the
universe. I'm sure there are hard-coded 32s various places.

~Faith

On Wed, Aug 21, 2024 at 8:13 AM Christophe JAILLET <
christophe.jaillet at wanadoo.fr> wrote:

> Hi,
>
> I'm new to this list, so sorry if it is not the correct place.
>
> I've started to looked at the source code of mesa and I wonder why in
> src/util/bitset.h we have:
>
>      #define BITSET_WORD unsigned int
>
> This is as-is since at least 2015, probably 2011.
>
> Would it make sense to have it as a long, at least on 64 bits arch?
> (the linux kernel uses bitmaps as unsigned long)
>
> I don't think that it should be a noticeable speed-up, but at least on
> Linux it could save some cycles when doing some OR or AND and co on
> bitmaps on a 64 bits cpu.
>
> Just my 2c.
>
> Christophe JAILLET
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20240821/91502eb3/attachment.htm>


More information about the mesa-dev mailing list