Opened 3 years ago

Last modified 3 years ago

#4036 closed defect

Slow addElemHideSelectors performance with Chrome >= 51 — at Version 1

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

Description (last modified by kzar)


  • Chrome both Version 51.0.2704.36 beta (64-bit) and Version 52.0.2729.3 dev (64-bit)
  • EasyList subscription with AA enabled
  • Debian Linux Stretch 64bit
  • Thinkpad T450

How to reproduce

  1. Start recording a CPU profile using the Chrome profiling tool.
  2. Open
  3. Once loaded stop recording the profile and take a look.

Observed behaviour

More than 6000ms is spent in the addElemHideSelectors function in the include.preload.js content script.

Expected behaviour

With earlier Chrome versions around 300ms is spent in that function.


  • I couldn't reproduce the issue with either Version 49.0.2623.75 (64-bit) or Version 50.0.2661.94 (64-bit).
  • This seems completely unrelated to issue #235, performance of ElemHide.getSelectorsByDomain() seems to be just as fast with newer Chrome versions.
  • I don't think this is down to a deopt with new Chrome versions, or at least the profiler doesn't show any deoptimisation warnings. (See the attached screenshot.)
  • See related discussion in the forum (Note: The title seems incorrect, it seems that the problem started with version 51 not 50.)
  • The problem seems to be caused by the while loop inside addElemHideSelectors somehow. When that is commented out the problem goes away. (The problem does not go away when only the style.sheet.addRule line is commented so it looks like the problem could be with the line above.)

Change History (2)

Changed 3 years ago by kzar

Screenshot of addElemHideSelectors profiling in Chrome 52

comment:1 Changed 3 years ago by kzar

  • Description modified (diff)
Note: See TracTickets for help on using tickets.