Repository navigation
Pack HTTP cache policy flags and optional integers - #22078
charliermarsh merged 2 commits into
Conversation
b301269 to
115b8f0
Compare
ww-oai
left a comment
There was a problem hiding this comment.
Looks reasonable to me! One small question: can we use bitflags here or does it not compose well with rkyv?
(Just noticed we're doing some of the same things that I think bitflags handles for us with e.g. previews.)
115b8f0 to
a2e0171
Compare
Merging this PR will degrade performance by 5.9%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
We revert the cache-format stack so `main` retains the 0.12 cache formats and bucket versions. These changes are deferred to 0.13. This reverts the following PRs together, including the six cache bucket bumps and the serialization and Windows lock-name changes that depend on them: - #22052: Refresh HTTP cache policies in place - #22059: Store source distribution revision IDs inline - #22060: Remove the legacy hash digest cache representation - #22061: Derive serialization for cached artifact records - #22062: Use bounded wheel cache lock names on Windows - #22078: Pack HTTP cache policy flags and optional integers - #22079: Align cached HTTP policies within the payload buffer
Reapplies #22078 for 0.13. We store the same HTTP cache information in fewer bytes, without changing cache freshness or revalidation behavior. - **Booleans become bits.** Ten fields like `no_cache`, `no_store`, and `immutable` each occupied a byte. We pack them into bits of one integer. - **Optional numbers share their presence flags.** Each archived `Option<u64>` occupies 16 bytes: the number, an indicator of whether it exists, and alignment padding. We store the numbers together and use one bit per number to indicate whether it exists. For example, `max_age = None` and `max_age = Some(0)` both store the number `0`, but their presence bits differ. Getters reconstruct the normal `Option<u64>`. We apply this to cache-control directives and response timestamps. The fixed archived policy shrinks from **320 to 200 bytes**. We use `bitflags` for typed flag operations and retain endian-aware integers in the archived representation. The cache bucket bumps cover the new representation.
Reapplies #22078 for 0.13. We store the same HTTP cache information in fewer bytes, without changing cache freshness or revalidation behavior. - **Booleans become bits.** Ten fields like `no_cache`, `no_store`, and `immutable` each occupied a byte. We pack them into bits of one integer. - **Optional numbers share their presence flags.** Each archived `Option<u64>` occupies 16 bytes: the number, an indicator of whether it exists, and alignment padding. We store the numbers together and use one bit per number to indicate whether it exists. For example, `max_age = None` and `max_age = Some(0)` both store the number `0`, but their presence bits differ. Getters reconstruct the normal `Option<u64>`. We apply this to cache-control directives and response timestamps. The fixed archived policy shrinks from **320 to 200 bytes**. We use `bitflags` for typed flag operations and retain endian-aware integers in the archived representation. The cache bucket bumps cover the new representation.
Reapplies #22078 for 0.13. We store the same HTTP cache information in fewer bytes, without changing cache freshness or revalidation behavior. - **Booleans become bits.** Ten fields like `no_cache`, `no_store`, and `immutable` each occupied a byte. We pack them into bits of one integer. - **Optional numbers share their presence flags.** Each archived `Option<u64>` occupies 16 bytes: the number, an indicator of whether it exists, and alignment padding. We store the numbers together and use one bit per number to indicate whether it exists. For example, `max_age = None` and `max_age = Some(0)` both store the number `0`, but their presence bits differ. Getters reconstruct the normal `Option<u64>`. We apply this to cache-control directives and response timestamps. The fixed archived policy shrinks from **320 to 200 bytes**. We use `bitflags` for typed flag operations and retain endian-aware integers in the archived representation. The cache bucket bumps cover the new representation.
Reapplies astral-sh#22078 for 0.13. We store the same HTTP cache information in fewer bytes, without changing cache freshness or revalidation behavior. - **Booleans become bits.** Ten fields like `no_cache`, `no_store`, and `immutable` each occupied a byte. We pack them into bits of one integer. - **Optional numbers share their presence flags.** Each archived `Option<u64>` occupies 16 bytes: the number, an indicator of whether it exists, and alignment padding. We store the numbers together and use one bit per number to indicate whether it exists. For example, `max_age = None` and `max_age = Some(0)` both store the number `0`, but their presence bits differ. Getters reconstruct the normal `Option<u64>`. We apply this to cache-control directives and response timestamps. The fixed archived policy shrinks from **320 to 200 bytes**. We use `bitflags` for typed flag operations and retain endian-aware integers in the archived representation. The cache bucket bumps cover the new representation.
We store the same HTTP cache information in fewer bytes, without changing cache freshness or revalidation behavior.
no_cache,no_store, andimmutableeach occupied a byte. We pack them into bits of one integer.Option<u64>occupies 16 bytes: the number, an indicator of whether it exists, and alignment padding. We store the numbers together and use one bit per number to indicate whether it exists.For example,
max_age = Noneandmax_age = Some(0)both store the number0, but their presence bits differ. Getters reconstruct the normalOption<u64>.We apply this to cache-control directives and response timestamps. The fixed archived policy shrinks from 320 to 200 bytes. We use
bitflagsfor typed flag operations and retain endian-aware integers in the archived representation.The cache bucket bumps cover the new representation.