Opened 7 months ago

Closed 7 months ago

Last modified 4 months ago

#4752 closed defect (fixed)

Options page is extremely slow when dealing with large numbers of custom filters

Reported by: kzar Assignee: kzar
Priority: P3 Milestone: Adblock-Plus-1.13-for-Chrome-Opera
Module: Platform Keywords:
Cc: sebastian, mapx, greiner Blocked By:
Blocking: Platform: Chrome
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29369459/

Description (last modified by kzar)

Environment

Chrome 55
Adblock Plus 1.12.4

How to reproduce

  1. Download a copy of EasyList.
  2. Open it in a decent text editor, copy the whole thing to the clipboard.
  3. Open the Adblock Plus options page, select the "Add your own filters" tab.
  4. Click "Edit filters as raw text" and paste EasyList into the text area.
  5. Click to save your changes.
  6. Now attempt to "Edit filters as raw text" again, or attempt to remove even a single filter.

Observed behaviour

The options page becomes unresponsive and pegs the CPU, sometimes for a long time. Sometimes Chrome even considers that Adblock Plus has crashed.

Expected behaviour

The options page should use less CPU and be more responsive when dealing with large numbers of custom filters.

Hints for testers

Try pasting 10,000 filters from EasyList into the custom filters box. (Click "Edit filters as raw" and paste them in!) Then play with the custom filters interface and make sure Adblock Plus doesn't crash / take too long to respond. It's expected the interface will run a little slow, but it should still be usable. Things to try:

  • Selecting one / a few filters and clicking the Remove button.
  • Toggling the "Edit filters as raw" box a few times, try making some changes and applying them.
  • Try removing all filters.

Note: Before these changes even attempting to remove a single filter would effectively crash Adblock Plus in this test meaning no web browsing was possible.

Change History (8)

comment:1 Changed 7 months ago by kzar

Obviously it is expected that the interface might slow down when dealing with huge amounts of filters but I still think we can do better here. The interface becomes completely unusable as it stands.

I am not sure what's to blame, initially I suspected thousands of messages would be sent to the background page but apparently not as there's the "filters.importRaw" message. Also when clicking to remove a single filter it takes a huge amount of time until the "filters.remove" message is even sent, which makes me suspect there's something running slowly in the options page itself.

I will investigate when I get a chance.

Last edited 7 months ago by kzar (previous) (diff)

comment:2 Changed 7 months ago by kzar

  • Description modified (diff)

comment:3 Changed 7 months ago by kzar

  • Owner set to kzar
  • Review URL(s) modified (diff)

comment:4 Changed 7 months ago by kzar

  • Cc greiner added
  • Status changed from new to reviewing

(Adding Thomas as Cc since this involves the UI.)

It seems a big part of the performance problems was the code dealing with list boxes. Iterating through every filter is slow if there are thousands of filters! With these changes I found the interface much more responsive, there are likely further things we could improve too.

comment:5 Changed 7 months ago by abpbot

comment:6 Changed 7 months ago by kzar

  • Milestone set to Adblock-Plus-for-Chrome-Opera-next
  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:7 Changed 7 months ago by kzar

  • Description modified (diff)

comment:8 Changed 4 months ago by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Fixed in that it's far better compared to 1.12.4. It's still possible to trigger the OS "window not responding" warning but it finishes within 10-20 seconds instead of 60+.

ABP 1.12.4.1739
Chrome 49 / 56 / Windows 10
Chrome 56 / OS X 10.12
Chrome 56 / Ubuntu 16.04
Opera 37 / 41 / Windows 7
Safari 10 / OS X 10.12

Note: See TracTickets for help on using tickets.