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

Issue 29342830: Issue 4057 - Further speedup ElemHide.getSelectorsforDomain (Closed)

Created:
May 20, 2016, 5:54 a.m. by kzar
Modified:
May 25, 2016, 11:28 a.m.
Visibility:
Public.

Description

Issue 4057 - Further speedup ElemHide.getSelectorsforDomain

Patch Set 1 #

Total comments: 2

Patch Set 2 : Take care to remove filters from lookups #

Total comments: 8

Patch Set 3 : Further improvements #

Patch Set 4 : Rebased, unconditionalSelectors #

Total comments: 18

Patch Set 5 : Speed up ElemHide.remove #

Patch Set 6 : Addressed comments #

Total comments: 9

Patch Set 7 : Avoid extra dirty variable #

Total comments: 4

Patch Set 8 : Addressed nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+106 lines, -34 lines) Patch
M lib/elemHide.js View 1 2 3 4 5 6 7 7 chunks +104 lines, -28 lines 0 comments Download
M test/elemHide.js View 1 2 3 1 chunk +2 lines, -6 lines 0 comments Download

Messages

Total messages: 38
kzar
Patch Set 1
May 20, 2016, 5:57 a.m. (2016-05-20 05:57:01 UTC) #1
kzar
https://codereview.adblockplus.org/29342830/diff/29342831/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342831/lib/elemHide.js#newcode178 lib/elemHide.js:178: if (filterId == undefined) I guess we can remove ...
May 20, 2016, 8:11 a.m. (2016-05-20 08:11:12 UTC) #2
kzar
Patch Set 2 : Take care to remove filters from lookups https://codereview.adblockplus.org/29342830/diff/29342831/lib/elemHide.js File lib/elemHide.js (right): ...
May 20, 2016, 10:55 a.m. (2016-05-20 10:55:17 UTC) #3
Wladimir Palant
There are two parts here: 1) Referencing filters by numerical ID rather than text. 2) ...
May 20, 2016, 12:33 p.m. (2016-05-20 12:33:27 UTC) #4
Sebastian Noack
https://codereview.adblockplus.org/29342830/diff/29342834/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342834/lib/elemHide.js#newcode178 lib/elemHide.js:178: if (filterId == undefined) We always use typeof when ...
May 20, 2016, 1:03 p.m. (2016-05-20 13:03:04 UTC) #5
kzar
On 2016/05/20 12:33:27, Wladimir Palant wrote: > There are two parts here: > > 1) ...
May 20, 2016, 4:47 p.m. (2016-05-20 16:47:59 UTC) #6
Sebastian Noack
I'm not entirely surprised that the code is quite a bit faster if we have ...
May 20, 2016, 5:16 p.m. (2016-05-20 17:16:41 UTC) #7
kzar
Patch Set 3 : Further improvements https://codereview.adblockplus.org/29342830/diff/29342834/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342834/lib/elemHide.js#newcode178 lib/elemHide.js:178: if (filterId == ...
May 21, 2016, 4:43 a.m. (2016-05-21 04:43:09 UTC) #8
kzar
On 2016/05/20 17:16:41, Sebastian Noack wrote: > I'm not entirely surprised that the code is ...
May 21, 2016, 6:08 a.m. (2016-05-21 06:08:57 UTC) #9
Wladimir Palant
On 2016/05/21 06:08:57, kzar wrote: > I'll update the review when I get a chance, ...
May 21, 2016, 7:12 a.m. (2016-05-21 07:12:28 UTC) #10
kzar
On 2016/05/21 07:12:28, Wladimir Palant wrote: > On 2016/05/21 06:08:57, kzar wrote: > > I'll ...
May 21, 2016, 8:02 a.m. (2016-05-21 08:02:16 UTC) #11
Wladimir Palant
Actually, there is another change you should try first. The current implementation is slow because ...
May 21, 2016, 12:12 p.m. (2016-05-21 12:12:11 UTC) #12
kzar
Cool idea! I just got it working, I found it sped things up but not ...
May 23, 2016, 1:02 p.m. (2016-05-23 13:02:55 UTC) #13
kzar
Wow, got the fastest result yet by combining your idea with using filterByKey lookup for ...
May 23, 2016, 1:28 p.m. (2016-05-23 13:28:27 UTC) #14
Wladimir Palant
On 2016/05/23 13:28:27, kzar wrote: > Problem is it only worked when using an array ...
May 23, 2016, 1:44 p.m. (2016-05-23 13:44:16 UTC) #15
kzar
On 2016/05/23 13:44:16, Wladimir Palant wrote: > What about ... `(Math.random() * 0x00FFFFFF) | 0` ...
May 23, 2016, 4:01 p.m. (2016-05-23 16:01:35 UTC) #16
Wladimir Palant
On 2016/05/23 16:01:35, kzar wrote: > Nope, still much slower than if the lookup is ...
May 23, 2016, 6:29 p.m. (2016-05-23 18:29:18 UTC) #17
kzar
On 2016/05/23 18:29:18, Wladimir Palant wrote: > If I combine the unconditionalSelectors() idea above with ...
May 24, 2016, 8:42 a.m. (2016-05-24 08:42:33 UTC) #18
Sebastian Noack
On 2016/05/24 08:42:33, kzar wrote: > On 2016/05/23 18:29:18, Wladimir Palant wrote: > > If ...
May 24, 2016, 8:59 a.m. (2016-05-24 08:59:53 UTC) #19
kzar
So I did some new tests without using the profiler like you suggested: let start ...
May 24, 2016, 9:11 a.m. (2016-05-24 09:11:23 UTC) #20
kzar
Above tests were for Chrome 50. Now for Safari 9: Before 235: 19912ms (1x) 235: ...
May 24, 2016, 9:45 a.m. (2016-05-24 09:45:00 UTC) #21
kzar
Patch Set 4 : Rebased, unconditionalSelectors https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js#newcode256 lib/elemHide.js:256: if (usingGetSelectorsForDomain) I'm ...
May 24, 2016, 2:45 p.m. (2016-05-24 14:45:22 UTC) #22
Wladimir Palant
https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js#newcode204 lib/elemHide.js:204: // The new filter's selector is unconditionally applied to ...
May 24, 2016, 3:16 p.m. (2016-05-24 15:16:19 UTC) #23
Sebastian Noack
https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js#newcode531 lib/elemHide.js:531: if (specificOnly) Why do you still account for specificOnly ...
May 24, 2016, 3:20 p.m. (2016-05-24 15:20:08 UTC) #24
Wladimir Palant
https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js#newcode531 lib/elemHide.js:531: if (specificOnly) On 2016/05/24 15:20:07, Sebastian Noack wrote: > ...
May 24, 2016, 3:26 p.m. (2016-05-24 15:26:06 UTC) #25
kzar
https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js#newcode256 lib/elemHide.js:256: if (usingGetSelectorsForDomain) On 2016/05/24 15:16:19, Wladimir Palant wrote: > ...
May 24, 2016, 5:47 p.m. (2016-05-24 17:47:10 UTC) #26
kzar
https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js#newcode256 lib/elemHide.js:256: if (usingGetSelectorsForDomain) On 2016/05/24 17:47:09, kzar wrote: > On ...
May 24, 2016, 5:52 p.m. (2016-05-24 17:52:12 UTC) #27
kzar
Patch Set 5 : Speed up ElemHide.remove https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js#newcode256 lib/elemHide.js:256: if (usingGetSelectorsForDomain) ...
May 25, 2016, 4:57 a.m. (2016-05-25 04:57:17 UTC) #28
kzar
Patch Set 6 : Addressed comments https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29342997/lib/elemHide.js#newcode204 lib/elemHide.js:204: // The new ...
May 25, 2016, 5:12 a.m. (2016-05-25 05:12:24 UTC) #29
Sebastian Noack
https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js#newcode509 lib/elemHide.js:509: let selectors = specificOnly ? [] : unconditionalSelectors.slice(); You ...
May 25, 2016, 7:30 a.m. (2016-05-25 07:30:50 UTC) #30
Sebastian Noack
https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js#newcode509 lib/elemHide.js:509: let selectors = specificOnly ? [] : unconditionalSelectors.slice(); One ...
May 25, 2016, 7:40 a.m. (2016-05-25 07:40:26 UTC) #31
kzar
Patch Set 7 : Avoid extra dirty variable https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js#newcode509 lib/elemHide.js:509: let ...
May 25, 2016, 8:05 a.m. (2016-05-25 08:05:20 UTC) #32
Sebastian Noack
https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js#newcode509 lib/elemHide.js:509: let selectors = specificOnly ? [] : unconditionalSelectors.slice(); On ...
May 25, 2016, 8:11 a.m. (2016-05-25 08:11:56 UTC) #33
kzar
https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js#newcode509 lib/elemHide.js:509: let selectors = specificOnly ? [] : unconditionalSelectors.slice(); On ...
May 25, 2016, 8:29 a.m. (2016-05-25 08:29:04 UTC) #34
Wladimir Palant
I really like the current version, only a few nits below. https://codereview.adblockplus.org/29342830/diff/29343026/lib/elemHide.js File lib/elemHide.js (right): ...
May 25, 2016, 10:43 a.m. (2016-05-25 10:43:04 UTC) #35
kzar
Patch Set 8 : Addressed nits https://codereview.adblockplus.org/29342830/diff/29343029/lib/elemHide.js File lib/elemHide.js (right): https://codereview.adblockplus.org/29342830/diff/29343029/lib/elemHide.js#newcode65 lib/elemHide.js:65: * the array ...
May 25, 2016, 10:51 a.m. (2016-05-25 10:51:29 UTC) #36
Wladimir Palant
LGTM
May 25, 2016, 11:01 a.m. (2016-05-25 11:01:11 UTC) #37
Sebastian Noack
May 25, 2016, 11:19 a.m. (2016-05-25 11:19:37 UTC) #38
LGTM

Powered by Google App Engine
This is Rietveld