Opened on 11/04/2018 at 11:09:59 PM
Closed on 11/04/2018 at 11:30:02 PM
#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): |
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.