Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Mar 2011 21:46:04 -0500
From:      Gary Palmer <gpalmer@freebsd.org>
To:        Jeremy Chadwick <freebsd@jdc.parodius.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Strange performance issue with grep -r -i as non-root user
Message-ID:  <20110306024604.GA7746@in-addr.com>
In-Reply-To: <20110305234514.GA34594@icarus.home.lan>
References:  <20110305234514.GA34594@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 05, 2011 at 03:45:14PM -0800, Jeremy Chadwick wrote:
> This is a strange one, and the more I started debugging it (starting
> with truss, comparing fast vs. slow results, where all that appears
> different is read() operations are taking a lot longer -- I haven't had
> time to check with ktrace yet), the more strange it got: that's when I
> found out the behaviour changes depending on if you're a user or root.
> 
> Easy to reproduce:
> 
> - grep -r string /usr/src, as non-root, is fast
> - grep -r -i string /usr/src, as non-root, is 8x slower than without -i
> - grep -r string /usr/src, as root, is fast
> - grep -r -i string /usr/src, as root, is fast

This is a stab in the dark, but are there any differences in your
shell environment variables between root and non-root?  Specifically
LANG or LC_ style variables.  I ran into issues in the past with grep
being horrendously slow and traced it to LANG or LC_* in the environment
causing a much longer code path than without the settings.

Regards,

Gary




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110306024604.GA7746>