This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Make getenv O(1)


On Fri, Oct 18, 2013 at 04:58:43PM +0400, Alexander Monakov wrote:
> Hi,
> 
> I'm curious about the motivation of this change.  Which programs are expected
> to benefit from faster repeated getenv queries?  (note that bash overrides
> getenv and co, so changes in glibc implementation won't affect it)
> 
Mostly those that call getenv in hot path. This mostly issue of
libraries, for example fnmatch checks getenv ("POSIXLY_CORRECT") so you
get definite slowdonw in following case.

time locate "[abc]aaa"
for I in `seq 1 10000`; do export FOO$I=$I; done
time locate "[abc]aaa"

You could argue that this does not help when likely case is that
variable is not defined. For that I would need posix say that changing
variable name via environ pointers is illegal.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]