Skip to content

fix(utils): remove lookbehind regexp for better performance #6236

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

Merged
merged 8 commits into from
Apr 11, 2025

Conversation

christian-bromann
Copy link
Member

What is the current behavior?

We have been using a negative look-ahead regexp which turned out to be extremely slow for hydrating components on the fly. This patch optimises the Regexp to be more performant.

GitHub Issue Number: #6226

Documentation

n/a

Does this introduce a breaking change?

  • Yes
  • No

Testing

We have extensive unit tests in place for this function.

Other information

n/a

@christian-bromann christian-bromann requested a review from a team as a code owner April 10, 2025 17:02
@johnjenkins
Copy link
Contributor

@christian-bromann - I wonder if you should add a test - similar to this one https://github.com/stenciljs/core/blob/main/test/wdio/ssr-hydration/cmp.test.tsx#L196 To measure SSR render performance time with a large stylesheet?

@christian-bromann
Copy link
Member Author

@johnjenkins added a test for the update. With the original code the time for executing the function has been stable around 2s, now with the patch it is between 3-5ms.

@christian-bromann christian-bromann merged commit 2f712bc into main Apr 11, 2025
141 of 144 checks passed
@christian-bromann christian-bromann deleted the cb/lookbehind-fix branch April 11, 2025 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants