mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55:00 +00:00
perf: minimize temporary strings for better performance (#1255)
This commit is contained in:
parent
53a55467f1
commit
48bb8e91de
8 changed files with 35 additions and 23 deletions
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using Avalonia.Data.Converters;
|
||||
|
@ -22,7 +22,7 @@ namespace SourceGit.Converters
|
|||
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
var prefixLen = home.EndsWith('/') ? home.Length - 1 : home.Length;
|
||||
if (v.StartsWith(home, StringComparison.Ordinal))
|
||||
return "~" + v.Substring(prefixLen);
|
||||
return $"~{v.AsSpan().Slice(prefixLen)}";
|
||||
|
||||
return v;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue