Skip to content

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

Merged
christian-bromann merged 8 commits into
mainfrom
cb/lookbehind-fix
Apr 11, 2025
Merged

fix(utils): remove lookbehind regexp for better performance#6236
christian-bromann merged 8 commits into
mainfrom
cb/lookbehind-fix

Conversation

@christian-bromann

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@christian-bromann
christian-bromann deleted the cb/lookbehind-fix branch April 11, 2025 20:51
hshandilya-cloudflare added a commit to hshandilya-cloudflare/realtimekit-ui that referenced this pull request Jul 30, 2026
Pull in stenciljs/core#6236 to fix StencilJS generating regular expressions that fail on Safari 16
hshandilya-cloudflare added a commit to hshandilya-cloudflare/realtimekit-ui that referenced this pull request Jul 30, 2026
Pull in stenciljs/core#6236 to fix StencilJS generating regular expressions that fail on Safari 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants