Opened 5 years ago

Closed 5 years ago

#1502 closed change (fixed)

Cache translation catalogs on Safari

Reported by: sebastian Assignee: sebastian
Priority: P3 Milestone: Adblock-Plus-1.8.8-for-Chrome-Opera-Safari
Module: Platform Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/6326608939974656

Description (last modified by sebastian)

Background

Since Safari doesn't come with an i18n system for extensions, we ported 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.

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.

Initially 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.

What to change

Cache the loaded and parsed translation catalogs on Safari.

Change History (3)

comment:1 Changed 5 years ago by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 5 years ago by sebastian

  • Description modified (diff)

comment:3 Changed 5 years ago by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-Safari-next
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.