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

Delta Between Two Patch Sets: lib/matcher.js

Issue 29877558: Noissue - Avoid redundant lookup in keyword-by-filter map (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Use string comparison Created Sept. 18, 2018, 12:37 p.m.
Right Patch Set: Revert to Patch Set 1 Created Sept. 19, 2018, 6:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 * @param {RegExpFilter} filter 341 * @param {RegExpFilter} filter
342 * @returns {boolean} 342 * @returns {boolean}
343 */ 343 */
344 isSlowFilter(filter) 344 isSlowFilter(filter)
345 { 345 {
346 let matcher = ( 346 let matcher = (
347 filter instanceof WhitelistFilter ? this.whitelist : this.blacklist 347 filter instanceof WhitelistFilter ? this.whitelist : this.blacklist
348 ); 348 );
349 let keyword = matcher.getKeywordForFilter(filter); 349 let keyword = matcher.getKeywordForFilter(filter);
350 if (keyword != null) 350 if (keyword != null)
351 return keyword == ""; 351 return !keyword;
Manish Jethani 2018/09/18 14:10:26 Well hold on, if we change this here to `keyword =
352 return !matcher.findKeyword(filter); 352 return !matcher.findKeyword(filter);
353 } 353 }
354 354
355 /** 355 /**
356 * Optimized filter matching testing both whitelist and blacklist matchers 356 * Optimized filter matching testing both whitelist and blacklist matchers
357 * simultaneously. For parameters see 357 * simultaneously. For parameters see
358 {@link Matcher#matchesAny Matcher.matchesAny()}. 358 {@link Matcher#matchesAny Matcher.matchesAny()}.
359 * @see Matcher#matchesAny 359 * @see Matcher#matchesAny
360 * @inheritdoc 360 * @inheritdoc
361 */ 361 */
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 exports.CombinedMatcher = CombinedMatcher; 415 exports.CombinedMatcher = CombinedMatcher;
416 416
417 /** 417 /**
418 * Shared {@link CombinedMatcher} instance that should usually be used. 418 * Shared {@link CombinedMatcher} instance that should usually be used.
419 * @type {CombinedMatcher} 419 * @type {CombinedMatcher}
420 */ 420 */
421 let defaultMatcher = new CombinedMatcher(); 421 let defaultMatcher = new CombinedMatcher();
422 422
423 exports.defaultMatcher = defaultMatcher; 423 exports.defaultMatcher = defaultMatcher;
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld