Was going to log a new bug, but this one looks very similar. Heres the
details I found.
Peter try setting LANG to something matching under /usr/lib/locale and
run your test to see if we have the same bug. probably en_CA.utf8
----------------------------------------------------------------------------
Ive noticed a small performance hit arising from locale settings.
Ubunutu (gnome-language-selector) sets lang in a format like:
LANG=en_AU.UTF-8
LANGUAGE=en_AU:en
LC_CTYPE="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8"
LC_TIME="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_PAPER="en_AU.UTF-8"
LC_NAME="en_AU.UTF-8"
LC_ADDRESS="en_AU.UTF-8"
LC_TELEPHONE="en_AU.UTF-8"
LC_MEASUREMENT="en_AU.UTF-8"
LC_IDENTIFICATION="en_AU.UTF-8"
When binaries are executed, the LANG is looked up in /usr/lib/locale,
which on my system looks like:
[EMAIL PROTECTED]:/usr/lib/locale$ ls
en_AU.utf8 en_DK.utf8 en_IE.utf8 en_PH.utf8 en_ZA.utf8
en_BW.utf8 en_GB.utf8 en_IN en_SG.utf8 en_ZW.utf8
en_CA.utf8 en_HK.utf8 en_NZ.utf8 en_US.utf8
They dont match up, en_AU.utf8 vs en_AU.UTF-8
With the default LANG, running strace across various binaries, 'ls' for example
gives many messages such as:
open("/usr/lib/locale/en_AU.UTF-8/LC_CTYPE", O_RDONLY) = -1 ENOENT (No such
file or directory)
With LANG=en_AU.UTF-8
strace -c ls
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.000062 4 14 read
0.00 0.000000 0 1 write
0.00 0.000000 0 105 77 open
0.00 0.000000 0 29 close
0.00 0.000000 0 1 execve
0.00 0.000000 0 12 12 access
0.00 0.000000 0 3 brk
0.00 0.000000 0 2 2 ioctl
0.00 0.000000 0 6 munmap
0.00 0.000000 0 1 mprotect
0.00 0.000000 0 1 _sysctl
0.00 0.000000 0 2 rt_sigaction
0.00 0.000000 0 1 rt_sigprocmask
0.00 0.000000 0 1 getrlimit
0.00 0.000000 0 42 mmap2
0.00 0.000000 0 29 fstat64
0.00 0.000000 0 2 getdents64
0.00 0.000000 0 1 fcntl64
0.00 0.000000 0 2 futex
0.00 0.000000 0 1 set_thread_area
0.00 0.000000 0 1 set_tid_address
------ ----------- ----------- --------- --------- ----------------
100.00 0.000062 257 91 total
With LANG=en_AU.utf8, to match the directory in /usr/lib/locale
strace -c ls
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
nan 0.000000 0 14 read
nan 0.000000 0 3 write
nan 0.000000 0 93 65 open
nan 0.000000 0 29 close
nan 0.000000 0 1 execve
nan 0.000000 0 12 12 access
nan 0.000000 0 3 brk
nan 0.000000 0 2 ioctl
nan 0.000000 0 6 munmap
nan 0.000000 0 1 mprotect
nan 0.000000 0 1 _sysctl
nan 0.000000 0 2 rt_sigaction
nan 0.000000 0 1 rt_sigprocmask
nan 0.000000 0 1 getrlimit
nan 0.000000 0 42 mmap2
nan 0.000000 0 29 fstat64
nan 0.000000 0 2 getdents64
nan 0.000000 0 1 fcntl64
nan 0.000000 0 2 futex
nan 0.000000 0 1 set_thread_area
nan 0.000000 0 1 set_tid_address
------ ----------- ----------- --------- --------- ----------------
100.00 0.000000 247 77 total
Having a LANG that doesn't match a directory in /usr/lib/locale
generates 10 more system calls, and 14 more errors.
Testing something a bit more substantial than 'ls', heres the summary of
the first process for firefox.
export LANG=en_AU.UTF-8
strace -c firefox
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.000684 7627 2064 total
export LANG=en_AU.utf8
strace -c firefox
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.000446 7550 2039 total
77 More system calls.
Reporting this because every little bit of performance helps.
Andrew Hendry.
--
huge performance hit for -i with UTF-8 locales
https://launchpad.net/bugs/75695
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs