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
Shrink the react key size in metadata RSC payload #50739
Conversation
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.
Approving because this will materially benefit the situation. However The approach still relies on layered filtering/mapping and a final clone at the end. When Metadata was first implemented I didn't have a good answer for why components were worse than functions but I think that with the current contraint of only emitting what is necessary it's clear that this should be refactored to use accumulation style functions rather than components. IMO the components don't really make it easier to read or contribute too and the necessitate a lot of allocations that really just aren't needed. Since we are writing lib code we need to favor perf more than an app might which can make better decisions around preferred abstractions relative to perf characteristics.
@gnoff I’ll think of how to refactor the whole structure, currently bit complex to pass down one counter to iterate across all components, wanna design a easy way to write it elegantly |
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
Nice change! This was very noticeable in my RSC parser. |
Follow up for vercel#50678 as @gnoff commented in vercel#50678 (review) Now metadata is shorter with the shorter key with just numbers ``` self.__next_f.push([1,"5:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"]) ```
Follow up for #50678 as @gnoff commented in #50678 (review)
Now metadata is shorter with the shorter key with just numbers