-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Use Box<CalcLengthOrPercentage> in specified values to avoid bloating inline sizes #15065
Conversation
Heads up! This PR modifies the following files:
|
For reference this brings the numbers down to
|
For Gecko, we still have a 416-byte clip-path and 232 byte border-image-source. Might be worth boxing these (and some of the other top properties). Also should investigate the sizes of properties in vector longhands; don't want too much memory to be used in case of capacity preallocation.
|
Do you hace any runtime numbers for this? Length is a commonly used type on the stack too, and these are a lot of new allocations. |
Length only allocates if there's a calc in there. Calcs are pretty rare, and worth allocating for. |
In general, boxing CalcLoP sounds fine to me. FWIW, I don't see any value in having CalcLoP store each of its possible components as a separate field, rather than a list of some sort, when it will be very rare to have anything other than a single length unit plus a percentage, and since we don't need random access to the fields anyway (we just take them one by one for serialization, and converting to computed values, AFAICT). |
@bors-servo r+ |
📌 Commit cff661c has been approved by |
⌛ Testing commit cff661c with merge 8824dcc... |
@Manishearth could you squash the commits if you have the time or this doesn't merge on first try? I don't love "Fix tidy" style commits. |
(Thought that's also debatable, I guess?) Anyway :) |
💔 Test failed - mac-dev-unit |
cff661c
to
79d85e5
Compare
@bors-servo r=heycam |
📌 Commit 79d85e5 has been approved by |
Use Box<CalcLengthOrPercentage> in specified values to avoid bloating inline sizes For #15061 CalcLOP is a large struct, and gets used quite often. While #15063 reduces its size a bit, it will still be much larger than any of the other variants in the `specified::Length*` types, so it will still bloat sizes, especially for specified values that contain many lengths. This change boxes it in the length types, so that it just takes one word. r? @heycam <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15065) <!-- Reviewable:end -->
@bors-servo r- Please do squash. |
@heycam You mean something like this? |
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev |
@bors-servo r=heycam |
📌 Commit 79d85e5 has been approved by |
@bors-servo r- |
79d85e5
to
f59557d
Compare
@bors-servo r=heycam git push -f |
📌 Commit f59557d has been approved by |
Use Box<CalcLengthOrPercentage> in specified values to avoid bloating inline sizes For #15061 CalcLOP is a large struct, and gets used quite often. While #15063 reduces its size a bit, it will still be much larger than any of the other variants in the `specified::Length*` types, so it will still bloat sizes, especially for specified values that contain many lengths. This change boxes it in the length types, so that it just takes one word. r? @heycam <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15065) <!-- Reviewable:end -->
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev |
For #15061
CalcLOP is a large struct, and gets used quite often. While #15063 reduces its size a bit,
it will still be much larger than any of the other variants in the
specified::Length*
types,so it will still bloat sizes, especially for specified values that contain many lengths.
This change boxes it in the length types, so that it just takes one word.
r? @heycam
This change is