-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: precalculate used values on the Style
diverging it from computed styles even more For the zoom property, which multiplies every length by a zoom factor, I tested out continuing on the current path, which involved a function for each of the affected properties. It was significantly slower (perf-2 got 10ms slower pretty consistently). I decided it's better to pre-calculate used values immediately. These aren't fully used values per the spec: for example, a percentage `width` will still be a percentage `width`, but they are reduced as much as they can be. Since the style tree is far smaller than the document tree, this is affordable. I tried a hundred re-parses of the document in the demo site and Style only took around 17ms. The difference in practice for hyperscript users will be even more negligible.
- Loading branch information
Showing
4 changed files
with
27 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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