mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +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,5 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -31,7 +32,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
_repo = repo;
|
||||
_revision = commit.SHA;
|
||||
_saveFile = $"archive-{commit.SHA.Substring(0, 10)}.zip";
|
||||
_saveFile = $"archive-{commit.SHA.AsSpan().Slice(0, 10)}.zip";
|
||||
BasedOn = commit;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Avalonia.Threading;
|
||||
|
@ -30,7 +31,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
_repo = repo;
|
||||
|
||||
Title = $"{file} @ {revision.Substring(0, 10)}";
|
||||
Title = $"{file} @ {revision.AsSpan().Slice(0, 10)}";
|
||||
Task.Run(() =>
|
||||
{
|
||||
var result = new Commands.Blame(repo, file, revision).Result();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using Avalonia.Collections;
|
||||
|
@ -584,7 +584,7 @@ namespace SourceGit.ViewModels
|
|||
var home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
var prefixLen = home.EndsWith('/') ? home.Length - 1 : home.Length;
|
||||
if (path.StartsWith(home, StringComparison.Ordinal))
|
||||
path = "~" + path.Substring(prefixLen);
|
||||
path = $"~{path.AsSpan().Slice(prefixLen)}";
|
||||
}
|
||||
|
||||
Title = $"[{workspace}] {name} ({path})";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue