-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring work in static network filtering engine
The original motivation is to further speed up launch time for either non-selfie-based and selfie-based initialization of the static network filtering engine (SNFE). As a result of the refactoring: Filters are no longer instance-based, they are sequence-of- integer-based. This eliminates the need to create instances of filters at launch, and consequently eliminates all the calls to class constructors, the resulting churning of memory, and so forth. All the properties defining filter instances are now as much as possible 32-bit integer-based, and these are allocated in a single module-scoped typed array -- this eliminates the need to allocate memory for every filter being instantiated. Not all filter properties can be represented as a 32-bit integer, and in this case a filter class can allocate slots into another module-scoped array of references. As a result, this eliminates a lot of memory allocations when the SNFE is populated with filters, and this makes the saving and loading of selfie more straightforward, as the operation is reduced to saving/loading two arrays, one of 32-bit integers, and the other, much smaller, an array JSON-able values. All filter classes now only contain static methods, and all of these methods are called with an index to the specific filter data in the module-scoped array of 32-bit integers. The filter sequences (used to avoid the use of JS arrays) are also allocated in the single module-scoped array of 32-bit integers -- they used to be stored in their own dedicated array. Additionally, some filters are now loaded more in a deferred way, so as reduce uBO's time-to-readiness -- the outcome of this still needs to be evaluated, time-to-readiness is especially a concern in Firefox for Android or less powerful computers.
- Loading branch information
Showing
6 changed files
with
1,466 additions
and
1,752 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.