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

Issue 29801555: Noissue - Check only first two characters for exception marker (Closed)

Created:
June 7, 2018, 9:22 a.m. by Manish Jethani
Modified:
June 7, 2018, 2:09 p.m.
Reviewers:
sergei, kzar
Base URL:
https://hg.adblockplus.org/adblockpluscore/
Visibility:
Public.

Description

In theory String.indexOf would search the entire string, whereas we are only interested in the first two characters here. I tried three approaches: String.startsWith, Stirng.substring(0, 2) == "@@", and the [] operator. The last one is the fastest. In practice this does not appear to make any significant difference in the performance of RegExpFilter.fromText, but maybe it's more visible on mobile and such.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M lib/filterClasses.js View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 3
Manish Jethani
June 7, 2018, 9:22 a.m. (2018-06-07 09:22:51 UTC) #1
Manish Jethani
Patch Set 1 See description above.
June 7, 2018, 9:58 a.m. (2018-06-07 09:58:52 UTC) #2
kzar
June 7, 2018, 1:38 p.m. (2018-06-07 13:38:25 UTC) #3
LGTM

Powered by Google App Engine
This is Rietveld