Repository navigation
Optimize Compose HTML EAP SSR rendering - #5756
Open
Clemens Koprolin (clemenskoprolin) wants to merge 8 commits into
Open
Clemens Koprolin (clemenskoprolin) wants to merge 8 commits into
Clemens Koprolin (clemenskoprolin) wants to merge 8 commits into
Conversation
Oleksandr Karpovich (eymar)
self-requested a review
October 15, 2026 08:03
| require( | ||
| name.isNotEmpty() && | ||
| name.none { it.isISOControl() || it in InvalidHtmlAttributeNameCharacters } | ||
| name.none { |
Member
There was a problem hiding this comment.
This change compromises readability for better performance.
Also, I see there is a cache - HtmlAttributeNameCache.
Is not the HtmlAttributeNameCache the more important change performance-wise?
Will it matter if we keep this function more readable but less optimized?
Collaborator
Author
There was a problem hiding this comment.
Good point, I'll benchmark that specific optimization.
Collaborator
Author
There was a problem hiding this comment.
You’re right: the cache is the more important optimization here, I'll restore it to be more readable.
| requireValidHtmlTagName(tagName) | ||
| tagNameIsValid: Boolean, | ||
| ): StartTagResult { | ||
| if (!tagNameIsValid) requireValidHtmlTagName(tagName) |
Member
There was a problem hiding this comment.
here too, should this be skipped when validate is false?
Also, below: requireHtmlParserStableTableElement ?
This file contains hidden or 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
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.
This PR reduces rendering overhead in Compose HTML EAP string, streaming and hydrated-document rendering.
Performance changes include:
Rendering now uses the caller’s current snapshot. State changes from content and synchronous effects remain there. Callers requiring consistent reads and isolated writes should enter a mutable snapshot.
In our benchmarks, this reduced the first render 13.3%, subsequent renders by 27.7% and reduced the allocated heap by 19.6%.
Involves CMP-10836
Testing
Run from the
htmldirectory:Release Notes
N/A