format output slightly more nicely
This commit is contained in:
parent
88cea8be53
commit
640ae5aea5
13
Program.cs
13
Program.cs
|
|
@ -12,13 +12,17 @@ using System.Threading.Tasks;
|
|||
using SkiaSharp;
|
||||
|
||||
int currentImageSize = 1024;
|
||||
string combinedOutputString = string.Empty;
|
||||
|
||||
(bool success, double totalTimeTakenSecondsOutput) = BenchmarkFunction(() =>
|
||||
{
|
||||
(float[] result, double timeTakenSecondsEvaluate) = BenchmarkFunction(() =>
|
||||
{
|
||||
Instruction[] instructions = Parsing.Parse("Programs/prospero.vm");
|
||||
return Interpreter.Evaluate(instructions, imageSize: currentImageSize);
|
||||
});
|
||||
|
||||
Console.WriteLine($"Sharpero took: {timeTakenSecondsEvaluate} seconds to evaluate {currentImageSize}x{currentImageSize} image!");
|
||||
combinedOutputString += $" - took: {timeTakenSecondsEvaluate} seconds to evaluate the image!" + Environment.NewLine;
|
||||
|
||||
(bool success, double timeTakenSecondsOutput) = BenchmarkFunction(() =>
|
||||
{
|
||||
|
|
@ -26,7 +30,12 @@ Console.WriteLine($"Sharpero took: {timeTakenSecondsEvaluate} seconds to evaluat
|
|||
return true;
|
||||
});
|
||||
|
||||
Console.WriteLine($"Sharpero took: {timeTakenSecondsOutput} seconds to write out {currentImageSize}x{currentImageSize} image!");
|
||||
combinedOutputString += $" - took: {timeTakenSecondsOutput} seconds to write out image!" + Environment.NewLine;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
Console.Write($"Sharpero took: {totalTimeTakenSecondsOutput} seconds to evaluate {currentImageSize}x{currentImageSize} image!" + Environment.NewLine + combinedOutputString);
|
||||
|
||||
(T, double) BenchmarkFunction<T>(Func<T> benchmarkedFunction)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue