Skip to content

Update TextMateSharp and syntax highlight using ReadOnlyMemory<char> for reduced allocations#550

Merged
grokys merged 7 commits intomasterfrom
readonly-memory
Jan 16, 2026
Merged

Update TextMateSharp and syntax highlight using ReadOnlyMemory<char> for reduced allocations#550
grokys merged 7 commits intomasterfrom
readonly-memory

Conversation

@danipen
Copy link
Collaborator

@danipen danipen commented Dec 16, 2025

This PR upgrades TextMateSharp from v1.0.x to v2.0.2 and adds ReadOnlyMemory<char> APIs to reduce string allocations during syntax highlighting.

Benchmark Results

See danipen/TextMateSharp#100

Tested with a 133,439 line C# file (5.8 MB):

Metric master This PR Improvement
Execution Time 4.752 s 2.681 s 44% faster
Memory Allocated 658.27 MB 496.36 MB 25% less
Gen0 Collections 82,000 62,000 24% fewer
Gen1 Collections 8,000 4,000 50% fewer

<IncludeSymbols>true</IncludeSymbols>
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<Version>11.3.0</Version>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danipen shouldn't this be bumped?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimal required version

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimal required version

@Gillibald
Isn't that property the main version number for AvaloniaEdit? Don't you bump the version number when you release a new version? Or is this not the version number for the AvaloniaEdit nuget package?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a release branch, so the version should not be adjusted. If a release is prepared, this needs to be adjusted.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks. Will a release be coming? I'm still waiting to get a fix for a bug that was fixed back in May. Much appreciated!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gillibald @danipen will there be a release created soon?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@udlose there are nightly builds for AvaloniaEdit, but not automatic. You can use 11.3.999-cibuild0059117-beta, but it doesn't include this PR

Copy link

@udlose udlose Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@udlose there are nightly builds for AvaloniaEdit, but not automatic. You can use 11.3.999-cibuild0059117-beta, but it doesn't include this PR

Thanks @maxkatz6! seems like a dumb question but how can i access it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grokys grokys enabled auto-merge January 16, 2026 08:00
@grokys grokys merged commit 79093d4 into master Jan 16, 2026
2 checks passed
@grokys grokys changed the title Syntax highlight using ReadOnlyMemory<char> for reduced allocations Update TextMateSharp and syntax highlight using ReadOnlyMemory<char> for reduced allocations Jan 16, 2026
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.

5 participants