Globals: remove unused property StartingRepositorySubDir
The property is set in class GitTfs by calling `git rev-parse --show-prefix` but it is never used. Remove it and also the useless invocation of git rev-parse to improve the overall startup time of git-tfs. For me this leads to a reduction of round about 85 ms in startup time, as can be seen in the measurement with hyperfine. # Version before this change c:\src\git-tfs>hyperfine --warmup=3 -i src\GitTfs\bin\Debug\net472\git-tfs.exe Benchmark 1: src\GitTfs\bin\Debug\net472\git-tfs.exe Time (mean ± s): 825.7 ms ± 15.5 ms [User: 5.4 ms, System: 16.1 ms] Range (min … max): 800.8 ms … 852.0 ms 10 runs Warning: Ignoring non-zero exit code. # Version with this change c:\src\git-tfs>hyperfine --warmup=3 -i src\GitTfs\bin\Debug\net472\git-tfs.exe Benchmark 1: src\GitTfs\bin\Debug\net472\git-tfs.exe Time (mean ± s): 740.9 ms ± 30.8 ms [User: 3.4 ms, System: 23.4 ms] Range (min … max): 695.4 ms … 792.3 ms 10 runs
This commit is contained in:
@@ -111,15 +111,6 @@ namespace GitTfs
|
||||
|
||||
public void InitializeGlobals()
|
||||
{
|
||||
var git = _container.GetInstance<IGitHelpers>();
|
||||
try
|
||||
{
|
||||
_globals.StartingRepositorySubDir = git.CommandOneline("rev-parse", "--show-prefix");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_globals.StartingRepositorySubDir = "";
|
||||
}
|
||||
if (_globals.GitDir != null)
|
||||
{
|
||||
_globals.GitDirSetByUser = true;
|
||||
|
||||
@@ -96,8 +96,6 @@ namespace GitTfs
|
||||
|
||||
public bool GitDirSetByUser { get; set; }
|
||||
|
||||
public string StartingRepositorySubDir { get; set; }
|
||||
|
||||
public IGitRepository Repository { get; set; }
|
||||
|
||||
public int GcCountdown { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user