After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 368001 - dlopening ~120 files in /usr/lib/gconv/
dlopening ~120 files in /usr/lib/gconv/
Status: RESOLVED OBSOLETE
Product: gnome-terminal
Classification: Core
Component: general
2.12.x
Other All
: Normal normal
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-30 23:41 UTC by Morten Welinder
Modified: 2018-02-28 17:00 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
Comments the while() that apparently creates the lag. (1.61 KB, patch)
2006-12-02 18:52 UTC, Diego Escalante Urrelo (not reading bugmail)
none Details | Review

Description Morten Welinder 2006-10-30 23:41:54 UTC
This is for a vanilla SuSE 10.1 install, if that matters.

Starting up the first gnome-terminal takes entirely too long, so
I did a strace and started looking.

Font-config is doing loads of stupid things, but it does so for
other gnome applications too, so I won't blame gnome-terminal for
that.

However. one thing that gnome-terminal does and that, say, Gnumeric
does not is something locale related:

> grep gconv ~/ttt | head
open("/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = 3 <0.000017>
open("/usr/lib/gconv/ISO8859-1.so", O_RDONLY) = 4 <0.000030>
open("/usr/lib/gconv/ISO8859-2.so", O_RDONLY) = 16 <0.017475>
open("/usr/lib/gconv/ISO8859-3.so", O_RDONLY) = 16 <0.000076>
...

And it in facts mmaps these, so they are likely the result of dlopens.
There are ~120 of these, so this adds up.

I am not doing anything fancy locale-wise:

> locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Comment 1 Mariano Suárez-Alvarez 2006-10-31 00:33:34 UTC
The terminal does, at start up time, a test to see if the conversions it knows about work cleanly in the system it is running in.

While not all of these tests can be deferred (a couple are needed to see if things are going to work at all), one could try to see if deferring most of those tests to when the Terminal->Character Encoding->Add or Remove... dialog gets run.
This might end up in an unbearable lag when showing that dialog. 

Most of this happens (quite previsibly ;-) in src/encodings.c.
Comment 2 Morten Welinder 2006-10-31 01:51:39 UTC
You could use an idle handler, then.  Every time it triggers it could
handle a single encoding.  Unless someone went directly to
    Terminal->Character Encoding->Add or Remove...
that should handle everything in the background.
Comment 3 Joachim Breitner 2006-11-15 08:27:42 UTC
Or a simple progress bar dialogue “please wait, reading locale data“ if it really takes more than one second to open Terminal->Character Encoding->Add or Remove... People don’t go there too often, I presue, at least not as often as opening the terminal, where the “unbearable lag” is now :-)
Comment 4 Sebastian Spaeth 2006-11-15 08:49:29 UTC
I agree with comment #3. While deferring the lookup in an idle loop sounds better than doing them during start-up, adding an encoding should be a *very seldomly* operation, so I'd prefer not doing this work at all (if it's not absolutely necessary). Loading the encodings when I chose the menu entry and showing progress in a dialog progress bar (or in the status bar) sounds like an acceptable solution.
Comment 5 Roberto Piscitello 2006-11-15 10:35:13 UTC
When "Terminal->Character Encoding->Add or Remove..." is opened, the lookup could start and populate the list one item at a time with an idle handler.
So no proress bar and no startup slow-down.
Comment 6 Diego Escalante Urrelo (not reading bugmail) 2006-12-02 18:52:54 UTC
Created attachment 77548 [details] [review]
Comments the while() that apparently creates the lag.

This patch is a first test I did to check if there's something gained. I don't know if I commented the right code.
I repeat that this is only a test.

Opinions please.
Comment 7 Mariano Suárez-Alvarez 2006-12-02 20:49:28 UTC
Diego, isn't that patch simply disabling all encoding testing?
Comment 8 Diego Escalante Urrelo (not reading bugmail) 2006-12-03 02:14:34 UTC
Yes I know, but as I said it's just for testing if there's a startup speed improvement. I made it after a quick check of the source.

So basically I wanted to check if this is worth doing :). 
Comment 9 Diego Escalante Urrelo (not reading bugmail) 2006-12-04 18:49:08 UTC
Forgot to say that I didn't get any boost.
Comment 10 Christian Persch 2008-05-29 20:29:56 UTC
This is semi-fixed by not checking all encodings until the enc dialogue is opened.

What's the reason for validating the encodings for ASCII-pass-throught? I noticed there are several encodings in our list that will NEVER be valid, e.g. UTF-16 and UTF-32.
Comment 11 Christian Persch 2018-02-28 17:00:24 UTC
This has been fixed.