[Mesa-dev] Building with -fno-builtin-memcmp for improved performance

Roland Scheidegger sroland at vmware.com
Tue Sep 20 07:02:47 PDT 2011

Am 20.09.2011 12:35, schrieb Keith Whitwell:
> On Tue, 2011-09-20 at 10:59 +0200, Fabio wrote:
>> There was a discussion some months ago about using -fno-builtin-memcmp for 
>> improving memcmp performance:
>> http://lists.freedesktop.org/archives/mesa-dev/2011-June/009078.html
>> Since then, was it properly addressed in mesa or the flag is still 
>> recommended? If so, what about adding it in configure.ac?
> I've been meaning to follow up on this too.  I don't know the answer,
> but pinging Roland in case he does.

I guess it is still recommended.
Ideally this is really something which should be fixed in gcc - the
compiler has all the knowledge about fixed alignment and size (if any)
(and more importantly knows if only a binary answer is needed which
makes this much easier) and doesn't need to do any function call.
If you enable that flag and some platform just has the same primitive
repz cmpsb sequence in the system library it will just get even slower,
though I guess chances of that happening are slim (with the possible
exception of windows).
I think in most cases it won't make much difference, so nobody cared to
implement that change. It is most likely still a good idea unless gcc
addressed that in the meantime...


More information about the mesa-dev mailing list