mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-15 14:05:39 +00:00
[PR #621] [MERGED] April perf improvements #1147
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/621
Author: @MihaZupan
Created: 4/15/2022
Status: ✅ Merged
Merged: 4/20/2022
Merged by: @xoofx
Base:
master← Head:perf-april📝 Commits (10+)
e11a263Reduce the size of Inline and casting overhead6eacf8aReduce casts when renderinge2770d8Reduce covariance check overheada946c6dUse local over list access in GetSourcePosition89e4c29Inline simple property getters47a22bcReduce the size of LiteralInline and EmphasisDelimiterInlineb2eeaf7Store trivia next to DataEntries53dff53Make LinkInline SourceSpan fields non-nullable76e2583Use method table pointer instead of TypeHandleee732e5Add ToHtml helper accepting a TextWriter📊 Changes
31 files changed (+674 additions, -238 deletions)
View changed files
➕
src/Markdig.Tests/TestLazySubstring.cs(+67 -0)📝
src/Markdig.Tests/TestMarkdigCoreApi.cs(+29 -0)📝
src/Markdig/Extensions/AutoLinks/AutoLinkParser.cs(+47 -47)📝
src/Markdig/Extensions/Bootstrap/BootstrapExtension.cs(+12 -9)📝
src/Markdig/Helpers/ArrayHelper.cs(+1 -0)➕
src/Markdig/Helpers/BlockWrapper.cs(+30 -0)📝
src/Markdig/Helpers/CharHelper.cs(+1 -1)➕
src/Markdig/Helpers/LazySubstring.cs(+44 -0)📝
src/Markdig/Markdown.cs(+22 -0)📝
src/Markdig/MarkdownPipeline.cs(+1 -1)📝
src/Markdig/Parsers/BlockProcessor.cs(+21 -13)📝
src/Markdig/Parsers/InlineProcessor.cs(+49 -9)📝
src/Markdig/Parsers/Inlines/CodeInlineParser.cs(+12 -3)📝
src/Markdig/Parsers/Inlines/EmphasisInlineParser.cs(+14 -9)📝
src/Markdig/Parsers/Inlines/LiteralInlineParser.cs(+7 -5)📝
src/Markdig/Parsers/ListBlockParser.cs(+1 -1)📝
src/Markdig/Parsers/NumberedListItemParser.cs(+11 -1)📝
src/Markdig/Renderers/Html/Inlines/CodeInlineRenderer.cs(+2 -2)📝
src/Markdig/Renderers/Normalize/Inlines/CodeInlineRenderer.cs(+9 -8)📝
src/Markdig/Renderers/RendererBase.cs(+40 -9)...and 11 more files
📄 Description
Interesting changes:
Inlines)MarkdownObjectto store the type and then doingUnsafecastsCodeInline.ContentType.GetTypeHandlewith the method table pointerPerf:
Default pipeline
Parsing (~5% speedup, ~8% fewer allocated bytes)
Rendering (2-10% speedup)
Advanced pipeline
Parsing (7-16% speedup, ~7% fewer allocated bytes)
Rendering
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.