Its really a problem when you have all possible locales installed.

Why don't you use a cache which hashes the /usr/lib/locale/ file names
to keep track of newly installed locales?
I did a slow test script in my tea break which only uses ksh built ins:
fle...@meridian:~/tmp/localecache$ timex locale -a >/dev/null

real           0.31
user           0.08
sys            0.13

fle...@meridian:~/tmp/localecache$ timex ksh93 cached_locale_a.sh >/dev/null

real           0.06
user           0.03
sys            0.01

I can do more refinements, including using builtin -f libshell.so.1
stat to watch ctime/mtime (don't use /usr/gnu/bin/stat, that makes the
script slower than locale -a), if there is interest.

Olga

2010/4/16 Nicolas Williams <[email protected]>:
> On Fri, Apr 16, 2010 at 07:44:44PM +0200, ольга крыжановская wrote:
>> Really locale -a? This is the most expensive operation /usr/bin/locale
>
> Yes.  We couldn't find any better way to get the list of available
> locales.  There's actually a bug in sshd where it invokes locale -a
> either twice or four times (I forget) instead of just one
> per-connection.  Perhaps only the master listener should execute locale
> -a; but then if you were to install locales you'd have to restart the
> ssh service.
>
>> can ever do and takes 30 or more seconds on older machines (49 seconds
>> on an Ultra5).
>
> It can also be painful on machines that are near the point of thrashing
> or beyond.  I never noticed this on older machines though.
>
> Nico
> --
>



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     [email protected]   \-`\-'----.
 `'-..-| /     Solaris/BSD//C/C++ programmer   \ |-..-'`
      /\/\                                     /\/\
      `--`                                      `--`

Attachment: cached_locale_a.sh
Description: Bourne shell script

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to