Skip to content

Performance Considerations #47

Description

@victor-livefront

Description

MarkdownUI wraps UITextView backed by TextKit, which supports incremental text editing.

From what I understand, Textual is a pure SwiftUI implementation. StructuredText(markdown:) calls AttributedString(markdown:) synchronously on every update, which parses the entire string from scratch every time.

This is an issue for me because I'm streaming text in as it's available, so StructuredText() may happen 100s of times before I get a complete markdown doc. Markdown() did not have this issue. The result is a visual performance hit, where rendering slows down significantly.

I understand if the intention was to use a pure SwiftUI implementation, but because of this, I'm not able to use this package.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

Incremental UI updates. No performance issues.

Actual behavior

Rerendering of UI, with visual UI slowdown.

Steps to reproduce

No response

Textual version information

0.3.1

Destination operating system

iOS 26

Xcode version information

Xcode 26.4

Swift Compiler version information

swift-driver version: 1.148.6 Apple Swift version 6.3 (swiftlang-6.3.0.123.5 clang-2100.0.123.102)
Target: arm64-apple-macosx26.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions