Skip to content

Commit b78f6b0

Browse files
authored
perf: minimize temporary strings for better performance (#1332)
1 parent 5e85f6f commit b78f6b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ViewModels/Histories.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.IO;
@@ -387,7 +387,7 @@ public ContextMenu MakeContextMenu(ListBox list)
387387
{
388388
var builder = new StringBuilder();
389389
foreach (var c in selected)
390-
builder.AppendLine($"{c.SHA.Substring(0, 10)} - {c.Subject}");
390+
builder.AppendLine($"{c.SHA.AsSpan(0, 10)} - {c.Subject}");
391391

392392
App.CopyText(builder.ToString());
393393
e.Handled = true;
@@ -780,7 +780,7 @@ public ContextMenu MakeContextMenu(ListBox list)
780780
copyInfo.Icon = App.CreateMenuIcon("Icons.Info");
781781
copyInfo.Click += (_, e) =>
782782
{
783-
App.CopyText($"{commit.SHA.Substring(0, 10)} - {commit.Subject}");
783+
App.CopyText($"{commit.SHA.AsSpan(0, 10)} - {commit.Subject}");
784784
e.Handled = true;
785785
};
786786

0 commit comments

Comments
 (0)