Skip to content

Commit

Permalink
Update BenchmarksManager.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
jozzzzep committed Dec 8, 2020
1 parent 04987a3 commit f98e8c4
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,16 @@ static void AfterBenchmark()
int higherLength = GetTheHigherLength(currentBenchmarkResults.firstTypeName, currentBenchmarkResults.secondTypeName);
string firstTypeSpaces = new string(' ', higherLength - currentBenchmarkResults.firstTypeName.Length);
string secondTypeSpaces = new string(' ', higherLength - currentBenchmarkResults.secondTypeName.Length);
double changesPerSec1 = ChangesPerSecond(currentBenchmarkResults.changesAmount, currentBenchmarkResults.firstBenchmarkAverage.TotalSeconds);
double changesPerSec2 = ChangesPerSecond(currentBenchmarkResults.changesAmount, currentBenchmarkResults.secondBenchmarkAverage.TotalSeconds);
decimal changesPerSec1 = (decimal)ChangesPerSecond(currentBenchmarkResults.changesAmount, currentBenchmarkResults.firstBenchmarkAverage.TotalSeconds);
decimal changesPerSec2 = (decimal)ChangesPerSecond(currentBenchmarkResults.changesAmount, currentBenchmarkResults.secondBenchmarkAverage.TotalSeconds);

string[] afterBenchmarkLines =
{
string.Format("{0}" + firstTypeSpaces + "average: {1}", currentBenchmarkResults.firstTypeName, currentBenchmarkResults.firstBenchmarkAverage),
string.Format("{0}" + secondTypeSpaces + "average: {1}", currentBenchmarkResults.secondTypeName, currentBenchmarkResults.secondBenchmarkAverage),
" ",
string.Format("{0}" + firstTypeSpaces + "changes per second: {1}", currentBenchmarkResults.firstTypeName, (int)changesPerSec1),
string.Format("{0}" + secondTypeSpaces + "changes per second: {1}", currentBenchmarkResults.secondTypeName, (int)changesPerSec2),
string.Format("{0}" + firstTypeSpaces + "changes per second: {1}", currentBenchmarkResults.firstTypeName, (long)changesPerSec1),
string.Format("{0}" + secondTypeSpaces + "changes per second: {1}", currentBenchmarkResults.secondTypeName, (long)changesPerSec2),
" ",
string.Format("The type {0} performed better by {1}%", currentBenchmarkResults.BetterTypeName, currentBenchmarkResults.GetHowMuchBetterPercentage()),
};
Expand All @@ -215,14 +215,11 @@ static void AfterBenchmark()
WriteLines(afterBenchmarkLines);
SeparationLineSmall();
WriteLine("Press any key to return to the menu");
Utilities.SeparationLine();
SeparationLine();
currentBenchmarkResults = null;
Console.ReadKey();
MenuSystem.StartProgram();
}

static double ChangesPerSecond(int changes, double seconds)
{
return (changes / seconds);
}

static double ChangesPerSecond(int changes, double seconds) => (changes / seconds);
}

0 comments on commit f98e8c4

Please sign in to comment.