Skip to content

Fixed #10 - Update subscription text directly

Description

In the previous patch for https://issues.adblockplus.org/ticket/7029 we lost the subscriptions property of the Filter object; this means now we must look up the subscriptions for a filter every time there is an update to the subscription. But this does not have to be done for every filter, only for filters that have been added or removed.

Here we add an updateFilterText() method to the Subscription object (internal use only). It takes the text and returns the delta from the previous text (added and removed filters). We use this delta then to call addFilter() and removeFilter() for added and removed filters respectively.

This patch reduces the time spent in updateSubscriptionFilters() for EasyList by ~60%.

Tip: Add console.time("foo") and console.timeEnd("foo") to the beginning and end of the updateSubscriptionFilters() function to see the difference before and after the patch.

Checklist

  • Fixes the issue(s)
  • Updates tests and documentation
  • Passes all tests
  • Passes linting
  • Affects performance
    • CPU
    • Memory

@hfiguiere

Edited by Manish Jethani

Merge request reports