[PATCH 01/10] Add vectorized getenv for glibc use
Ondřej Bílka
neleai@seznam.cz
Fri May 17 07:46:00 GMT 2013
On Thu, May 16, 2013 at 07:12:46PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> This adds a general "vectorized getenv" for glibc internal use.
> The motivation is to allow subsystems to access environment variables
> cheaply without having to rescan the environment completely.
>
> + if (__builtin_expect ((*current)[0] == 'G', 0)
> + && (*current)[1] == 'L' && (*current)[2] == 'I'
> + && (*current)[3] == 'B' && (*current)[4] == 'C'
> + && (*current)[5] == '_')
This pattern repeats few times. A memcmp(current,"GLIBC",5) is shorter.
However I found that we and gcc do not expand memcmp. It will be slower
as in current codebase.
I will shortly post patch with header that expands memcmp.
Remind me to replace occurences when it will be accepted.
Ondra
More information about the Libc-alpha
mailing list