-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
about making breaking changes to serialization format #392
Comments
@ambyjkl this is a fun topic 😅 The biggest issue with expanding the bit flags beyond In terms of the on-disk serialization format - we can always append additional data to the end of the format, which will be ignored by earlier versions of The vision I have for #1 is to actually free up some of the existing flags using external mechanisms. As an example, if you look at |
On my 64 bit system, after rust's struct alignment, both u32 and u64 versions use 208 bytes per #[test]
fn compare() {
println!(
"with u32 {} with u64 {}",
std::mem::size_of::<NetworkFilter>(),
std::mem::size_of::<NetworkFilterNew>(),
);
} outputs:
With 32 bit, there would be a 4 byte increase, but I'm not sure how much that would matter, since the struct is already quite big. I see some low-hanging fruit that should immediately address some of this though. As for cache effects, there are some ways to deal with that, such as using a struct of arrays instead of an array of structs ( |
swapping out all the pub struct NetworkFilterNew {
pub mask: u64,
pub filter: FilterPart,
pub opt_domains: Option<Box<[Hash]>>,
pub opt_not_domains: Option<Box<[Hash]>>,
/// Used for `$redirect`, `$redirect-rule`, `$csp`, and `$removeparam` - only one of which is
/// supported per-rule.
pub modifier_option: Option<Box<str>>,
pub hostname: Option<Box<str>>,
pub(crate) tag: Option<Box<str>>,
pub raw_line: Option<Box<str>>,
pub id: Hash,
// All domain option values (their hashes) OR'ed together to quickly dismiss mis-matches
pub opt_domains_union: Option<Hash>,
pub opt_not_domains_union: Option<Hash>,
}
|
@antonok-edm I managed to find another memory optimization, a rather massive one at that, I would appreciate it if you took a look at it #393 |
As I was looking at potentially implementing more features from #1 and uBO-paritypending features that are already available in uBO
, I noticed that
NetworkFilterMask
is already full, and in order to add more bit flags, it would need to be expanded fromu32
tou64
. That will create a breaking change to the on-disk serialization format. What is the current policy about this?The text was updated successfully, but these errors were encountered: