-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
LibWeb: CSS Property computation optimizations #7647
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
Open
Calme1709
wants to merge
11
commits into
LadybirdBrowser:master
Choose a base branch
from
Calme1709:property-computation-optimizations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
LibWeb: CSS Property computation optimizations #7647
Calme1709
wants to merge
11
commits into
LadybirdBrowser:master
from
Calme1709:property-computation-optimizations
+707
−272
Conversation
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
The computation context used is the main thing distinguishing the computation of font/non-font properties so having a generic method to handle this will allow us to consolidate logic between the two.
Having these numbered doesn't add anything and makes diffs ugly when we add/remove a step
Previously we computed font properties separately from other properties
for two reasons:
1) These font properties were computed using a different length
resolution context than the rest of the properties.
2) These properties were required to be computed before creating the
length resolution context for the rest of the properties.
The first issue was solved in the previous commit by introducing a
generic method to get the computation context for a property, and
the second is solved in this commit by computing properties in the
required order.
This simplifies the code a bit and opens up some opportunities for
optimization.
This is always a no-op
In a future commit we will update `compute_properties` to avoid calling `compute_property_values` but we still need to store this value
We can avoid some overhead by computing the values immediately instead of setting them within `ComputedProperties` and then calling `compute_property_values`
There are cases where we can skip the property value computation process because we know that the computed value will be equal to the specified value
Previously we were doing this multiple times per property which was quite expensive
When we initialize `ComputedProperties` all flags are initially set to false so we only need to update them if they are true
This saves us having to access the HashMap in the common case there is no cascaded property
c71ce64 to
557c820
Compare
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.
A collection of optimizations to
StyleComputer::compute_propertieswhich collectively reduce runtime from ~31.5% to ~17.3% when loading https://en.wikipedia.org/wiki/2023_in_American_television - see individual commits for details.