Repository navigation
Conversation
gherrit-pr-id: Gfa0cb30780189c43bb84da57a9ade4d5a9754223
...so that they consume an `IntoBytes` as their source. Since these methods are private, this does not yet increase expressivity for users, but nonetheless allows the compiler to better optimize existing callsites. For example, the `ref_from_prefix_dynamic_size` benchmark becomes branchless, shrinking from 14 to 9 instructions. The falible suffix-with-elems benchmarks shrink from 24 to 17 instructions for dynamic size, and 28 to 20 instructions for dynamic padding. Only `try_ref_from_prefix_dynamic_size` regresses, from 19 to 20 instructions. gherrit-pr-id: Gd1b460a8ec2e8aa8adf2e070c329d9f209c7c89c
Refactors these routines to not depend on padding byte preservation across moves. Along the way, we make the `try_read_from` helper safe, generic, and better-optimized. Instruction counts for the `try_read_from_*` change by -36% to -55%. gherrit-pr-id: G35c8b8db33f4c984d5716af9a26c0a5ec9bd9c7e
This routine begins by rounding `bytes_len` down to the nearest multiple of `align` (thus computing the intermediary `max_total_bytes`), subtracting the offset of the trailing slice, and calculating how many elements (`elems`) fit in that space. Then, in an expensive computation involving `elems`, the element size, the trailing slice offset, `align`, the total `self_bytes` is computed. This commit observes that when the element size is no larger than the `align`, `self_bytes` is simply equal to `max_total_bytes`. For example, if `max_total_bytes` is 16 bytes, the header occupies 9 bytes and two 3-byte elements fit, they would occupy 15 bytes altogether, leaving 1 byte in excess. This excess must be smaller than one element, otherwise another element would fit. When `elem_size <= align`, the gap is smaller than `align` and trailing padding fills it exactly. gherrit-pr-id: G463fe47353c89d061e6458fa9c4bd19328a954a8
…ct casts gherrit-pr-id: G63f1cd381b283e8e5f75888830d802a40aa3507f
This was referenced Sep 23, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## G463fe47353c89d061e6458fa9c4bd19328a954a8 #3717 +/- ##
=============================================================================
- Coverage 92.68% 92.67% -0.01%
=============================================================================
Files 20 20
Lines 6464 6542 +78
=============================================================================
+ Hits 5991 6063 +72
- Misses 473 479 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
I'm going to close this one for now until after we solve #3617. |
Member
|
#3617 is fixed |
jswrenn
force-pushed
the
G463fe47353c89d061e6458fa9c4bd19328a954a8
branch
from
October 5, 2026 23:29
cc5799d to
6f00605
Compare
Collaborator
Author
|
Obsoleted (for now) by #3659. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CastType::Exactinstead of reusingPrefixfor exact casts #3717validate_cast_and_convert_metadata#3716TryFromBytes::try_read_from*#3712(try_)ref_from_prefix_suffix#3711ReadOnly#3682Latest Update: v2 — Compare vs v1
📚 Full Patch History
Links show the diff between the row version and the column version.
⬇️ Download this PR
Branch
git fetch origin refs/heads/G63f1cd381b283e8e5f75888830d802a40aa3507f && git checkout -b pr-G63f1cd381b283e8e5f75888830d802a40aa3507f FETCH_HEADCheckout
git fetch origin refs/heads/G63f1cd381b283e8e5f75888830d802a40aa3507f && git checkout FETCH_HEADCherry Pick
git fetch origin refs/heads/G63f1cd381b283e8e5f75888830d802a40aa3507f && git cherry-pick FETCH_HEADPull
Stacked PRs enabled by GHerrit.