Changes between Version 1 and Version 2 of Ticket #1502


Ignore:
Timestamp:
10/29/2014 07:44:17 AM (5 years ago)
Author:
sebastian
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1502 – Description

    v1 v2  
    11=== Background === 
    2 Initially I decided to send a (series of) new XMLHttpRequest(s) for every translated text, to load the catalog(s) for the current language from the disk, in order to keep things simple and to avoid unnecessary memory usage. 
     2Since Safari doesn't come with an i18n system for extensions, we ported [https://developer.chrome.com/extensions/i18n Chrome's i18n API] using synchronous XMLHttpRequests to load the catalogs. Initially I decided to send a new XMLHttpRequest for every translated text, in order to keep things simple and to avoid unnecessary memory usage. 
    33 
    4 However, it turned out that those requests, despite they just load local files from the extension bundle, take up to 400ms (on my Mac Mini). This is per translated text and the time for parsing the catalogs still comes on top. Also in some scenarios (e.g. when your language is `de-AU` and there is only a catalog for `de`) at least two requests are sent per translated text. 
     4However, it turned out that those requests, despite they just load local files from the extension bundle, take up to 400ms (on my Mac Mini). This is per translated text and the time for parsing the catalogs still comes on top. 
    55 
    66Initially I didn't consider that code a hotspot, but it kinda is one. Every time a request is blocked, parts of the popup UI are updated, included the translations used there. And as opposed to Chrome, the popup on Safari is also running if hidden. And since the popup runs in the same thread as the background page, all code running in the popup can delay requests processed by the background page.