[haiku-bugs] Re: [Haiku] #5582: [AboutSystem] is slow to appear

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Sun, 12 Jul 2020 11:43:20 -0000

#5582: [AboutSystem] is slow to appear
---------------------------------+----------------------------
  Reporter:  diver               |      Owner:  nobody
      Type:  bug                 |     Status:  assigned
  Priority:  normal              |  Milestone:  R1
 Component:  Kits/Interface Kit  |    Version:  R1/Development
Resolution:                      |   Keywords:
Blocked By:                      |   Blocking:
  Platform:  All                 |
---------------------------------+----------------------------
Comment (by pulkomandy):

 Apparently I never commented here. There are various things I can think of
 in the locale kit that could be slow, unfortunately, I don't know how to
 improve them without removing functionalities or changing APIs.

 **Catalog loading:**

 The locale kit looks in several places for catalogs. I think we removed
 loading them from attributes, but it looks in the application resources,
 and then in the packaged and non-packaged, user and system directories. Of
 course for system apps the catalogs are in packaged-system, which is the
 last place looked at (this allows testing catalogs that are not installed
 with the OS). Maybe we could stop looking in user/ for apps installed in
 system/ ?

 **String lookup:**
 Catalogs store strings in a hash map, with the key being the english
 string and context. This means the lookup for a string is done as follows:

 * 1) compute the hash from the original string and context
 * 2) search the hashmap for a matching hash
 * 3) compare the string and context from the matching entry with the
 initial ones to make sure there is no conflict
 * 4) finally, get the translated string

 Steps 1-3 could be removed if the key was an integer, with no risk of
 conflict. Doing this requires an ABI change, which is that B_TRANSLATE
 would parse its argument at compile-time and somehow replace it with an
 integer key for it.

 **ICU data loading:**

 ICU data is currently a .so file. I think it is loaded from disk (using
 dlopen()) in each app using ICU. Ideally, this data would be loaded only
 once and shared between all applications. This probably requires changes
 in ICU, or maybe in the locale kit at least, to tell ICU where to look for
 the data (maybe using a segment of shared memory for it). Normally this
 data is loaded on-demand, but in the case of AboutSystem, it will be
 needed for example to format the uptime string.

 While working on this, we should also switch to using a .dat file instead
 of a .so, allowing the reuse of the data between multiple gcc versions.
 However, I'm not sure we can do this with different ICU versions, and
 newer versions won't build with gcc8.
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/5582#comment:8>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: