Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tomekzaw
Copy link
Collaborator

@tomekzaw tomekzaw commented Nov 5, 2024

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 implement MarkdownSpan 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

@tomekzaw
Copy link
Collaborator Author

tomekzaw commented Nov 5, 2024

TODO: test performance

Copy link
Collaborator

@j-piasecki j-piasecki left a 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?

@tomekzaw
Copy link
Collaborator Author

tomekzaw commented Nov 6, 2024

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 ssb.getSpan call in favor of keeping a list of spans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants