-
Notifications
You must be signed in to change notification settings - Fork 117
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
Performance improvement on parsing from html #790
Merged
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
This reverts commit 36240e0.
1 task
daniloercoli
approved these changes
Mar 6, 2019
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.
Demo app works fine.
Also tried all kind of tests attached to the project and they worked as expected.
mzorz
reviewed
Mar 6, 2019
mzorz
reviewed
Mar 7, 2019
Mario mentioned to me over Slack that he has no further review comments to add so, this is now 👍 to merge when CI passes. |
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 introduces a couple of speed of optimizations to address the slow start of the editor when the content is large. Relevant issue on wpandroid: wordpress-mobile/gutenberg-mobile#672
What's included:
parseHtml...
method (parseHtmlForInspection
). This one is forked fromfromHtml()
and has these optimizations:a. Use of
SpannableString
instead ofSpannableStringBuilder
. We don't want the (slower)...Builder
variant here since we're not planning on modifying the text content of the String while processing it in this method. Some other functions were changed from expectingSpannableStringBuilder
to expecting aSpannable
since they didn't actually needed the editabilitySpannableStringBuilder
.b. Don't use the very expensive
addVisualNewlinesToBlockElements()
since the parsed content is not going to be used for rendering it in the editor.c. Don't use
markBlockElementsAsParagraphs()
since the spannable will not be used for editing at all so, no need for the PARAGRAPH_SPAN span behavior.d. Don't use
cleanupZWJ()
as it doesn't mattertagStack
to optimize the handling of end-tags inAztecTagHandler.kt
. Up to now,AztecTagHandler.end()
was usinggetLast()
which scans the spans to find the most recent "open" tag, but that can be sped up since we know about the nested nature of the html tags. So, a LIFO tracks the opening/closings of the tags and we normally expect the most recent open tag to be exactly at the top of the stack.Test A
Test B
Review
@[USER_NAME]