-
Notifications
You must be signed in to change notification settings - Fork 72
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
Improve removing spans on Android #537
base: main
Are you sure you want to change the base?
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.
The code looks good but what's the reasoning behind this change?
There's no particular reason for this change right now. Android spans are known to be slow and I want to see if we can make it faster by eliminating |
I've tested out this change on Google Pixel 4 in release mode with profiler attached and So there's no rush to get this PR merged as the performance is comparable. |
Details
This PR changes the way how spans are removed before applying new formatting.
Previously, we would call
ssb.getSpans(0, ssb.length(), MarkdownSpan.class)
to find all span added in the previous run. All added spans implementMarkdownSpan
interface.After this change, each time we add a span, we add it to
mMarkdownSpans
list (ArrayList
). Then, we iterate over that list to remove all previously added spans and clear the list afterwards.Related Issues
GH_LINK
Manual Tests
Linked PRs