mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-14 21:47:13 +00:00
[PR #606] [MERGED] Improvements when TrackTrivia is disabled #1136
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/xoofx/markdig/pull/606
Author: @MihaZupan
Created: 3/13/2022
Status: ✅ Merged
Merged: 3/14/2022
Merged by: @xoofx
Base:
master← Head:perf-march-2022📝 Commits (9)
1862b37Optimize LineReader.ReadLine9145f47Move TryParseInlineLinkTrivia to cold pathfb9561cFix roughLineCountEstimate calculation (min/max order)88cdbf3Lazily allocate CodeBlock.CodeBlockLines9f734baLazily allocate Trivia properties on LinkInlineb697a03Lazily allocate Trivia properties on LinkReferenceDefinition61452c9Aggressively avoid TrackTrivia work and allocations when not requested6f75b51Aggressively avoid TrackTrivia work and allocations when not requested for Inlinesb7d02caFix TrackTrivia /// comments📊 Changes
27 files changed (+499 additions, -301 deletions)
View changed files
📝
src/Markdig/Helpers/LineReader.cs(+42 -26)📝
src/Markdig/Helpers/StringSlice.cs(+9 -0)📝
src/Markdig/Parsers/FencedBlockParserBase.cs(+7 -3)📝
src/Markdig/Parsers/FencedCodeBlockParser.cs(+10 -4)📝
src/Markdig/Parsers/HeadingBlockParser.cs(+11 -6)📝
src/Markdig/Parsers/HtmlBlockParser.cs(+10 -4)📝
src/Markdig/Parsers/IndentedCodeBlockParser.cs(+21 -9)📝
src/Markdig/Parsers/Inlines/CodeInlineParser.cs(+8 -2)📝
src/Markdig/Parsers/Inlines/LinkInlineParser.cs(+91 -87)📝
src/Markdig/Parsers/ListBlockParser.cs(+21 -7)📝
src/Markdig/Parsers/MarkdownParser.cs(+2 -2)📝
src/Markdig/Parsers/ParagraphBlockParser.cs(+20 -10)📝
src/Markdig/Parsers/QuoteBlockParser.cs(+64 -45)📝
src/Markdig/Parsers/ThematicBreakParser.cs(+10 -4)📝
src/Markdig/Roundtrip.md(+2 -2)📝
src/Markdig/Syntax/Block.cs(+26 -8)📝
src/Markdig/Syntax/CodeBlock.cs(+2 -1)📝
src/Markdig/Syntax/FencedCodeBlock.cs(+21 -7)📝
src/Markdig/Syntax/HeadingBlock.cs(+13 -3)📝
src/Markdig/Syntax/IBlock.cs(+2 -2)...and 7 more files
📄 Description
A few changes mainly around reducing the overhead of the
TrackTriviaimpl even when it isn't requested:Span.IndexOfAny('\r', '\n')inLineReaderSyntaxobjects.I was playing around with two markdown documents for these:
Before
After
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.