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

Severe hang when rendering a short markdown string with 6-level nested bullet points #310

Open
3 tasks done
hsinlei opened this issue Apr 20, 2024 · 1 comment
Open
3 tasks done

Comments

@hsinlei
Copy link

hsinlei commented Apr 20, 2024

Thank you for contributing to MarkdownUI!

Before you submit an issue, please complete the report with all the relevant details for your bug and go through every item in the checklist.

Describe the bug
Severe hang (1-2s) when rendering a relatively short markdown string (~hundreds of characters) with nested bullet points (6 levels).

Checklist

  • I can reproduce this issue with a vanilla SwiftUI project.
  • I can reproduce this issue using the main branch of this package.
  • This bug hasn't been addressed in an existing GitHub issue.

Steps to reproduce
Explanation of how to reproduce the incorrect behavior. This could include an attached project, a link to code, or a Markdown-formatted text exhibiting the issue.

  1. Clone this minimal demo project
  2. Build and run it, tap the "Go" navigation link, and observe a 1-2s UI freezing before the view transition
  3. Profile and record the run using XCode Instruments Timing Profiling tool, tap the "Go" navigation link, and observe "Severe Hang" and 100% CPU usage

Expected behavior
Ideally no hang from rendering such a short markdown string. If heavy computation can't be easily optimized out, move the computation off of the main UI thread to avoid hangs.

Screenshots
Screenshot 2024-04-20 at 10 54 23 AM

Version information

  • MarkdownUI: 2.3.0
  • OS: iOS 17.4.1
  • Xcode: 15.2

Additional context

  • Looks like it has to do with the deeply nested bullet points (i.e. 6 levels)
  • Un-nesting the deepest level of bullets (i.e. moving them to become siblings of their original parent bullets) mitigates the Severe Hang into just Hang
  • Further un-nesting (i.e. reducing from 5 levels to 4 levels nested bullets) results in no Hang at all
@gonzalezreal
Copy link
Owner

Thanks for reporting. I will take a look as soon as I have some spare time.

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

No branches or pull requests

2 participants