Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 29893618: Issue 6957 - Return common style sheet for unknown domains (Closed)

Created:
Sept. 27, 2018, 9:18 p.m. by Manish Jethani
Modified:
Sept. 28, 2018, 5:40 p.m.
Reviewers:
hub, Jon Sonesen
Base URL:
https://hg.adblockplus.org/adblockpluscore/
Visibility:
Public.

Description

On most domains like example.com, manishjethani.com, and so on (domains that don't have any filters or exceptions associated with them), we inject the exact same style sheet. But we generate the last part of this style sheet each time in the generateStyleSheetForDomain function. This patch keeps a cache of known domains. If the given domain is not known (technically does not have any suffix that's known), it returns a complete cached "common" style sheet. For example, with the following filters: ##.foo ~bar.example.com##.not-bar bar.example.com##.bar On foo.example.com, we don't have a known suffix. In that case, we can just return the common style sheet (which includes two selectors, .foo and .not-bar). On bar.example.com, on the other hand, we must compute the selectors to include; here we use the existing code path, which concatenates the default style sheet (containing only .foo) to the dynamically generated style sheet (containing .bar, but not .not-bar). This adds ~320 KB to the memory footprint, but for a tremendous performance gain. It speeds up the generateStyleSheetForDomain function for unknown domains by ~50%. The follow-up patch to this will speed up the function by another ~80%, thus making the net gain ~90%.

Patch Set 1 #

Patch Set 2 : Minor improvements #

Patch Set 3 : Maintain only known exception domains #

Patch Set 4 : Slightly refactored #

Unified diffs Side-by-side diffs Delta from patch set Stats (+98 lines, -10 lines) Patch
M lib/elemHide.js View 1 2 3 6 chunks +98 lines, -10 lines 0 comments Download

Messages

Total messages: 6
Manish Jethani
Sept. 27, 2018, 9:18 p.m. (2018-09-27 21:18:43 UTC) #1
Manish Jethani
Patch Set 1 Please see the description above. With this and the follow-up patch to ...
Sept. 27, 2018, 9:46 p.m. (2018-09-27 21:46:40 UTC) #2
Manish Jethani
Patch Set 2: Minor improvements
Sept. 27, 2018, 9:51 p.m. (2018-09-27 21:51:35 UTC) #3
Manish Jethani
Patch Set 3: Maintain only known exception domains This version minimizes the changes to only ...
Sept. 28, 2018, 8:55 a.m. (2018-09-28 08:55:41 UTC) #4
Manish Jethani
Patch Set 4: Slightly refactored
Sept. 28, 2018, 3:53 p.m. (2018-09-28 15:53:17 UTC) #5
hub
Sept. 28, 2018, 4:35 p.m. (2018-09-28 16:35:43 UTC) #6
LGTM

Powered by Google App Engine
This is Rietveld