Opened 2 years ago

Closed 2 years ago

Last modified 21 months ago

#5735 closed change (fixed)

Use JS Map instead of Object

Reported by: sergz Assignee: sergz
Priority: P3 Milestone:
Module: Core Keywords:
Cc: trev, fhd Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29550598/
https://codereview.adblockplus.org/29550662/
https://codereview.adblockplus.org/29551632/
https://codereview.adblockplus.org/29551635/
https://codereview.adblockplus.org/29551638/
https://codereview.adblockplus.org/29551648/

Description (last modified by sergz)

Background

I was profiling memory usage of current adblockpluscore a little bit and discovered that after the changes described below the size of RSS is 10-15 MBs less for EasyList+AA, in particular instead of 80.+ MB originally, it's 70.- MBs with the changes (it's a memory usage of a special tests, not all functionality is there). Each change saves merely a few hundreds of KBs or a couple of MBs but in total it's a noticeable result.

I have also tried to change some other Objects which are used as containers to JS Map but it had not helped, so only these changes have a positive effect, at least in my tests.

What to change

Make to be Map:

  • Filter.knownFilters
  • Filter property domains after lazy evaluation
  • Matcher property filterByKeyword
  • Matcher property keywordByFilter
  • in elemHide.js
    • global keyByFilter
    • global filtersByDomain
    • filters which are stored in filtersByDomain

Integration notes

Please ensure in the dependent projects that the objects mentioned above are treated in accordance with the changes. In particular, the type of following objects changed from Object to Map:

  • Filter.knownFilters
  • domains property of Filter objects
  • Matcher properties filterByKeyword and keywordByFilter
  • global (module scoped) filtersByDomain and its values in elemHide.js
  • global (module scoped) keyByFilter in elemHide.js

Change History (10)

comment:1 Changed 2 years ago by trev

  • Priority changed from Unknown to P3
  • Ready set

comment:2 Changed 2 years ago by sergz

  • Review URL(s) modified (diff)

comment:3 Changed 2 years ago by sergz

  • Description modified (diff)

comment:4 Changed 2 years ago by trev

  • Description modified (diff)

comment:5 Changed 2 years ago by sergz

  • Description modified (diff)
  • Owner set to sergz
  • Review URL(s) modified (diff)

comment:6 Changed 2 years ago by sergz

  • Description modified (diff)
  • Review URL(s) modified (diff)

comment:7 Changed 2 years ago by sergz

  • Description modified (diff)
  • Review URL(s) modified (diff)

comment:9 Changed 2 years ago by sergz

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

comment:10 Changed 21 months ago by kzar

(Also see the discussion in #3095.)

Note: See TracTickets for help on using tickets.