-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix performance of splitCssText #1615
base: master
Are you sure you want to change the base?
Conversation
…ge css texts - e.g. for a (doubled) benchmark.css, we were running normalizeCssText 9480 times before k got to the right place
…make better guess at how big a jump to make - can reduce iter_limit from 300 to 50 to prove that this approach is better
🦋 Changeset detectedLatest commit: e5f22e3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Failed to launch the browser process! [...FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel ...
Failed to launch the browser process! [...FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel ...
…fault css values from shorthand properties when retrieved via `sheet.rules[0].cssText`
… if this LTS version also solves: Failed to launch the browser process! [...FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel ...
03f7351
to
6d3047a
Compare
… iterating through versions
…seemed to solve things
…xed with `runs-on: ubuntu-22.04`
There's a lot of commits in here that can be ignored as I was iterating trying to fix an issue in Github Actions |
. |
Lets add a PR for the GitHub Actions change and merge this one after that has happened |
See #1603 for an excellent bug report.
I didn't include the benchmark from that report as it didn't demonstrate the pathological cases that were being experienced in the wild, but rather just the degree of slowdown of the 'split' vs. 'no split' code paths.
See #1437 for the context as to why
splitCssText
exists;To recap, a <style> element can have multiple text nodes. We currently serialize by processing styleEl.sheet.cssRules into a single string, but if one of the text nodes is programmatically modified (via a text mutation), then we want to be able to map the mutation back to only modify the relevant part, and not blow away the entire css text if we were not to do the split in the first place.
This PR massively improves the performance of the splitting in the case where we need to search through large strings to find similar parts, we need to compare after normalization so there's a lot of back and forth. This PR changes that process to more like a binary search rather than a crawling search which was producing the pathological performance.