`NetworkFilterMask` is filled
The `NetworkFilterMask` bitflag struct is full; there's no room for additional information in it. This is hindering the adoption of new rule options and types.
Increasing the size of `NetworkFilterMask` from 32 to 64 bits is not a good solution because it will bloat the memory size of every parsed filter in the engine.
The optimal fix will involve reworking `NetworkFilter` and `NetworkFilterMask` to remove all the bits that are not actually checked at match time:
- `IS_CSP`
- `IS_IMPORTANT`
- `IS_REDIRECT`
- `IS_REMOVEPARAM`
- `GENERIC_HIDE`
- `BAD_FILTER`
These flags only determine which bin a network filter is placed into and not how they're matched at runtime, so they're wasted space in the in-memory representation of each filter bin. If we can return the information separately from the filter itself, we can discard it when adding it to the correct bin. So, parsing rules should return information about which bin a filter goes into alongside the filter itself.
Note all current bins:
- `csp`
- `importants`
- `redirects`
- `removeparam`
- `generic_hide`
- `tagged filters`
- `exceptions` (exception rules can appear in many bins, so we can't remove `IS_EXCEPTION`)
- `filters` (catch all for normal blocking filters)
0 条评论