Opened 2 years ago

Closed 2 years ago

Last modified 22 months ago

#5929 closed change (fixed)

Skip update subscription URLs in AndroidWebRequest if not required

Reported by: asmirnov Assignee:
Priority: Unknown Milestone:
Module: Unknown Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29588563/

Description

Background

In order to save memory AndroidWebRequest (https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java) filters out not required filters from subscriptions. For example if element hiding is disabled (enableElemhide =falsein ctor https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java#L60) it leaves lines from not listed subscriptions (https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java#L155) and removes lines with elemhide rules.

If element hiding is enabled (enableElemhide =truein ctor https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java#L60), this.elemhideEnabled (https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java#L50) is set to true and we need no listed subscription URLs at all as condition https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AndroidWebRequest.java#L155 is always true. So there will be no isListedSubscriptionUrl() invocations and we don't need subscription URLs list at all.

Thus we can skip calling androidWebRequest.updateSubscriptionURLs(engine.filterEngine); in https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java#L254 if element hiding is enabled (by default it is enabled https://github.com/adblockplus/libadblockplus-android/blob/master/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java#L159) and improve start-up time.

It's good because it happens in UI thread and UI is frozen for the user, so we can make UI more responsive with no cost at all (just skip doing what is not required).

What to change

Skip calling androidwebRequest.updateSubscriptionURLs() if element hiding is enabled.

Change History (4)

comment:1 Changed 2 years ago by asmirnov

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed 2 years ago by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.