Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#2582 closed change (fixed)

ElemHide.getSelectorsForDomain() cannot be optimized by V8

Reported by: sebastian Assignee: sebastian
Priority: P4 Milestone: Adblock-Plus-2.6.10-for-Firefox
Module: Core Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/5229474392047616

Description (last modified by sebastian)

Background

ElemHide.getSelectorsForDomain() is using a for..in to iterate over the keys of an object in hash-table mode. This prevents V8 from optimizing that function.

Currently, 30-60ms are spend in this function on every call, on my notebook with Chrome 43. However, when using Object.getOwnPropertyNames() only ~20ms are spent.

What to change

Iterate over the result of Object.getOwnPropertyNames() instead using a for..of loop in ElemHide.getSelectorsForDomain().

Change History (5)

comment:1 Changed 5 years ago by sebastian

  • Description modified (diff)
  • Priority changed from P3 to P4

comment:2 Changed 5 years ago by sebastian

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

comment:3 Changed 5 years ago by sebastian

  • Description modified (diff)

comment:4 Changed 5 years ago by sebastian

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:5 Changed 5 years ago by sebastian

  • Milestone set to Adblock-Plus-for-Firefox-next
Note: See TracTickets for help on using tickets.