minimize temporary strings for better performance (#1215)

(cherry picked from commit b4fa80c0939ca198bff8e858a4dc241efd31d558)
This commit is contained in:
qiufengshe 2025-04-21 09:43:13 +08:00 committed by leo
parent b4db88a663
commit 232482ca92
No known key found for this signature in database

View file

@ -1,4 +1,4 @@
using System; using System;
namespace SourceGit.Commands namespace SourceGit.Commands
{ {
@ -40,7 +40,7 @@ namespace SourceGit.Commands
if (dateEndIdx == -1) if (dateEndIdx == -1)
return; return;
var dateStr = line.Substring(0, dateEndIdx); var dateStr = line.AsSpan().Slice(0, dateEndIdx);
if (double.TryParse(dateStr, out var date)) if (double.TryParse(dateStr, out var date))
statistics.AddCommit(line.Substring(dateEndIdx + 1), date); statistics.AddCommit(line.Substring(dateEndIdx + 1), date);
} }