#7098 closed change (rejected)

Avoid writing to disk on each filter hit

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

https://codereview.adblockplus.org/29936555/

Description (last modified by mjethani)

Background

In lib/filterListener.js, we are calling setDirty with a 0 argument, making it write to disk. This makes sense if the filter's hit count has been reset, but it doesn't make sense if it was already zero. To make it worse, the extension repeatedly calls the function with old and new values 0 and 0 respectively on each filter hit, causing repeated writes to the local storage.

What to change

If the value of the oldValue parameter is 0, don't call setDirty with 0, instead default to 0.002.

Additional notes

This might be why the extension is causing the browser to freeze up (#7065).

Resolution

After some testing, it seems we are not writing to disk on every filter hit. This is because isDirty is 0 so there is no write.

It might still be a good idea to add a check, but it's not necessary.

Change History (4)

comment:1 Changed 13 months ago by mjethani

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

comment:2 Changed 13 months ago by mjethani

  • Description modified (diff)

comment:3 Changed 13 months ago by mjethani

  • Description modified (diff)

comment:4 Changed 13 months ago by mjethani

  • Description modified (diff)
  • Resolution set to rejected
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.