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

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

Can't Edit
Can't Publish+Mail
Start Review
1 year, 5 months ago by Manish Jethani
1 year, 5 months ago
hub, Jon Sonesen
Base URL:


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


Total messages: 6
Manish Jethani
1 year, 5 months ago (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 ...
1 year, 5 months ago (2018-09-27 21:46:40 UTC) #2
Manish Jethani
Patch Set 2: Minor improvements
1 year, 5 months ago (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 ...
1 year, 5 months ago (2018-09-28 08:55:41 UTC) #4
Manish Jethani
Patch Set 4: Slightly refactored
1 year, 5 months ago (2018-09-28 15:53:17 UTC) #5
1 year, 5 months ago (2018-09-28 16:35:43 UTC) #6
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 87257f5