-
Notifications
You must be signed in to change notification settings - Fork 171
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
skip calling getRemixValidPathsGenerationContext if not in remixScene #6073
Merged
Conversation
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
#13356 Bundle Size — 62.66MiB (~+0.01%).
Warning Bundle contains 70 duplicate packages – View duplicate packages Bundle metrics
|
Current #13356 |
Baseline #13355 |
|
---|---|---|
Initial JS | 45.71MiB (~+0.01% ) |
45.71MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 21.62% |
21.6% |
Chunks | 30 |
30 |
Assets | 33 |
33 |
Modules | 4374 |
4374 |
Duplicate Modules | 524 |
524 |
Duplicate Code | 31.7% |
31.7% |
Packages | 469 |
469 |
Duplicate Packages | 70 |
70 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #13356 |
Baseline #13355 |
|
---|---|---|
JS | 62.65MiB (~+0.01% ) |
62.65MiB |
HTML | 11.16KiB (-0.33% ) |
11.2KiB |
Bundle analysis report Branch performance/get-valid-paths Project dashboard
Rheeseyb
approved these changes
Jul 12, 2024
balazsbajorics
commented
Jul 12, 2024
} | ||
if (isRemixScene) { | ||
const remixPathGenerationContext = getRemixValidPathsGenerationContext(path) | ||
if (remixPathGenerationContext.type === 'active') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hide Whitespace recommended
ruggi
approved these changes
Jul 12, 2024
seanparsons
approved these changes
Jul 12, 2024
liady
pushed a commit
that referenced
this pull request
Dec 13, 2024
…#6073) **Problem:** When resizing a PromiseCard, it takes 7-8 ms to run useGetStoryboardRoot / getValidElementPaths which seems to spend most of its time on Remix matchRoutes. **Diagnosis:** Turns out, we had this three lines of code running for _every single element visited_ during the recursive `getValidElementPathsFromElement` walk: ``` const isRemixScene = isRemixSceneElement(element, filePath, projectContents) const remixPathGenerationContext = getRemixValidPathsGenerationContext(path) if (remixPathGenerationContext.type === 'active' && isRemixScene) { ``` `getRemixValidPathsGenerationContext` is not trivially cheap to call, and it only returns a sensible result if `path` points at a remix scene. **Fix:** Only call getRemixValidPathsGenerationContext if `isRemixScene` is true. Now `useGetStoryboardRoot` only takes 0.7ms instead of 7ms. <img width="120" alt="image" src="https://github.com/user-attachments/assets/750c33ac-13e1-43fd-90d1-200439ab5708"> **Note:** 0.7ms still feels excessive to run on every single frame, I'll continue the investigation and make a follow up PR **Manual Tests:** I hereby swear that: - [x] I opened a hydrogen project and it loaded - [x] I could navigate to various routes in Preview mode Fixes #6065
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.
Problem:
When resizing a PromiseCard, it takes 7-8 ms to run useGetStoryboardRoot / getValidElementPaths which seems to spend most of its time on Remix matchRoutes.
Diagnosis:
Turns out, we had this three lines of code running for every single element visited during the recursive
getValidElementPathsFromElement
walk:getRemixValidPathsGenerationContext
is not trivially cheap to call, and it only returns a sensible result ifpath
points at a remix scene.Fix:
Only call getRemixValidPathsGenerationContext if
isRemixScene
is true.Now
useGetStoryboardRoot
only takes 0.7ms instead of 7ms.Note: 0.7ms still feels excessive to run on every single frame, I'll continue the investigation and make a follow up PR
Manual Tests:
I hereby swear that:
Fixes #6065