From 2ca05ccad7a1db91a6631f8df44bd1f4a8228e84 Mon Sep 17 00:00:00 2001 From: Jason Nelson Date: Fri, 9 Feb 2024 13:13:31 -0800 Subject: [PATCH] Eliminate string allocation in CodeInlineRenderer --- .../Renderers/Normalize/Inlines/CodeInlineRenderer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Markdig/Renderers/Normalize/Inlines/CodeInlineRenderer.cs b/src/Markdig/Renderers/Normalize/Inlines/CodeInlineRenderer.cs index 7fdf42536..aaa38d8e7 100644 --- a/src/Markdig/Renderers/Normalize/Inlines/CodeInlineRenderer.cs +++ b/src/Markdig/Renderers/Normalize/Inlines/CodeInlineRenderer.cs @@ -31,8 +31,8 @@ protected override void Write(NormalizeRenderer renderer, CodeInline obj) if (delimiterCount < count) delimiterCount = count; } - var delimiterRun = new string(obj.Delimiter, delimiterCount + 1); - renderer.Write(delimiterRun); + + renderer.Write(obj.Delimiter, delimiterCount + 1); if (content.Length != 0) { if (content[0] == obj.Delimiter) @@ -49,6 +49,6 @@ protected override void Write(NormalizeRenderer renderer, CodeInline obj) { renderer.Write(' '); } - renderer.Write(delimiterRun); + renderer.Write(obj.Delimiter, delimiterCount + 1); } } \ No newline at end of file