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

.NET 8.0 and a few other perf improvements #751

Merged
merged 13 commits into from
Nov 25, 2023
Merged

Conversation

MihaZupan
Copy link
Collaborator

@MihaZupan MihaZupan commented Nov 25, 2023

  • Added a .NET 8.0 TFM
  • Polyfills for a few new functionalities (Ascii, SearchValues, ContainsAnyExcept ...)
  • Replaced the CharacterMap.IndexOfOpeningCharacter implementation with a call to IndexOfAny(SearchValues)
    • Don't need manual vectorization code in Markdig for this anymore
    • Also get AVX2 paths and ARM64 acceleration "for free"
  • Changed CodeInlineParser.Match to make use of vectorized helpers
  • Sped up WriteEscape & WriteEscapeUrl rendering (vectorized scanning via SearchValues)
  • A few random alloc / codegen improvements

A few rough numbers from parsing a large markdown document with precise source locations (.NET 8 perf improvements blogpost).
Both main and pr numbers are from 8.0

Method Job Mean Error Ratio
Parse main 2,762.2 us 13.73 us 1.00
Parse pr 2,509.3 us 13.97 us 0.91
ParseAdvanced main 7,991.8 us 49.89 us 1.00
ParseAdvanced pr 7,758.2 us 48.96 us 0.97
Render main 954.6 us 3.39 us 1.00
Render pr 710.6 us 2.42 us 0.74
RenderAdvanced main 1,301.3 us 4.76 us 1.00
RenderAdvanced pr 1,068.6 us 20.04 us 0.82
Including 7.0 vs 8.0 comparison
Method Job Runtime Mean Error Ratio
Parse main .NET 7.0 3,125.7 us 18.30 us 1.00
Parse pr .NET 8.0 2,486.9 us 9.08 us 0.80
ParseAdvanced main .NET 7.0 8,481.4 us 35.35 us 1.00
ParseAdvanced pr .NET 8.0 7,682.9 us 17.01 us 0.91
Render main .NET 7.0 1,140.1 us 4.04 us 1.00
Render pr .NET 8.0 711.8 us 1.49 us 0.62
RenderAdvanced main .NET 7.0 1,548.4 us 5.30 us 1.00
RenderAdvanced pr .NET 8.0 1,047.4 us 4.44 us 0.68

@xoofx
Copy link
Owner

xoofx commented Nov 25, 2023

Nice upgrade! Thanks @MihaZupan!

@xoofx xoofx merged commit 40fb2b8 into xoofx:master Nov 25, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants