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

Issue 29994555: Issue 7250 - Optimize third-party request check (Closed)

Created:
Jan. 31, 2019, 10:09 a.m. by Manish Jethani
Modified:
Feb. 4, 2019, 11:06 p.m.
Reviewers:
hub
Base URL:
https://hg.adblockplus.org/adblockpluscore/
Visibility:
Public.

Description

About the public suffix map: - Memory footprint: 224 KB - Time to build: 0.2% of extension startup time

Patch Set 1 : #

Total comments: 3

Patch Set 2 : Add JSDoc #

Patch Set 3 : Use NaN instead of null #

Total comments: 3

Patch Set 4 : Add tests #

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

Messages

Total messages: 8
Manish Jethani
Jan. 31, 2019, 10:09 a.m. (2019-01-31 10:09:34 UTC) #1
Manish Jethani
Patch Set 1 I'd like to get this into ABP 3.5. We going into code ...
Jan. 31, 2019, 10:14 a.m. (2019-01-31 10:14:15 UTC) #2
Manish Jethani
Patch Set 2: Add JSDoc Patch Set 3: Use NaN instead of null Also filed ...
Jan. 31, 2019, 12:23 p.m. (2019-01-31 12:23:59 UTC) #3
Manish Jethani
The tests are here: https://codereview.adblockplus.org/29993591/ I can include them in this patch if you like.
Jan. 31, 2019, 12:32 p.m. (2019-01-31 12:32:54 UTC) #4
hub
On 2019/01/31 12:32:54, Manish Jethani wrote: > The tests are here: > > https://codereview.adblockplus.org/29993591/ > ...
Feb. 1, 2019, 7:57 p.m. (2019-02-01 19:57:57 UTC) #5
hub
https://codereview.adblockplus.org/29994555/diff/29994562/lib/domain.js File lib/domain.js (right): https://codereview.adblockplus.org/29994555/diff/29994562/lib/domain.js#newcode37 lib/domain.js:37: map.set(key, publicSuffixes[key]); Wouldn't `new Map(publicSuffixes);` work?
Feb. 1, 2019, 7:58 p.m. (2019-02-01 19:58:08 UTC) #6
Manish Jethani
Patch Set 4: Add tests https://codereview.adblockplus.org/29994555/diff/29994562/lib/domain.js File lib/domain.js (right): https://codereview.adblockplus.org/29994555/diff/29994562/lib/domain.js#newcode37 lib/domain.js:37: map.set(key, publicSuffixes[key]); On 2019/02/01 ...
Feb. 2, 2019, 5:04 a.m. (2019-02-02 05:04:48 UTC) #7
hub
Feb. 4, 2019, 9:56 p.m. (2019-02-04 21:56:25 UTC) #8
LGTM

https://codereview.adblockplus.org/29994555/diff/29994562/lib/domain.js
File lib/domain.js (right):

https://codereview.adblockplus.org/29994555/diff/29994562/lib/domain.js#newco...
lib/domain.js:37: map.set(key, publicSuffixes[key]);
On 2019/02/02 05:04:47, Manish Jethani wrote:
> On 2019/02/01 19:58:08, hub wrote:
> > Wouldn't `new Map(publicSuffixes);` work?
> 
> No, the `Map` constructor expects a two-dimensional array (actually any
iterable
> that yields key-value pairs).
> 
> We could do this:
> 
>   return new Map(Object.keys(publicSuffixes)
>                  .map(key => [key, publicSuffixes[key]]));
> 
> But this is thrice as slow.
> 
> We could also do this:
> 
>   return new Map(Object.entries(publicSuffixes));
> 
> But this is only supported on Chrome 54+ and is actually 6-7 times as slow.
> 
> The way the function does it now is the fastest way to do it.

Acknowledged.

Powered by Google App Engine
This is Rietveld