Skip to content

Instantly share code, notes, and snippets.

@AhmedTarekHasan
Created June 26, 2022 11:36
Show Gist options
  • Save AhmedTarekHasan/1184e49cb181cc5a82804ccacdd6c686 to your computer and use it in GitHub Desktop.
Save AhmedTarekHasan/1184e49cb181cc5a82804ccacdd6c686 to your computer and use it in GitHub Desktop.
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
namespace Benchmarking
{
public class Program
{
static void Main(string[] args)
{
BenchmarkRunner.Run<MemoryBenchmarker>();
}
}
[MemoryDiagnoser]
[RankColumn]
public class MemoryBenchmarker
{
[Benchmark]
public decimal RunTemplateMethodPattern()
{
return TemplateMethodPattern.Program.Run();
}
[Benchmark]
public decimal RunTemplateMethodPatternWithProperties()
{
return TemplateMethodPatternWithProperties.Program.Run();
}
[Benchmark]
public decimal RunTemplateMethodPatternWithFlaggedEnums()
{
return TemplateMethodPatternWithFlaggedEnums.Program.Run();
}
[Benchmark]
public decimal RunTemplateMethodPatternWithInterfaces()
{
return TemplateMethodPatternWithInterfaces.Program.Run();
}
[Benchmark]
public decimal RunTemplateMethodPatternWithGeneratedExpressionUsingProperties()
{
return TemplateMethodPatternWithGeneratedExpressionUsingProperties.Program.Run();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment