Skip to content

Instantly share code, notes, and snippets.

@AhmedTarekHasan
Created June 26, 2022 10:49
Show Gist options
  • Save AhmedTarekHasan/dbde0a300de802fe9ccb9054908a15da to your computer and use it in GitHub Desktop.
Save AhmedTarekHasan/dbde0a300de802fe9ccb9054908a15da to your computer and use it in GitHub Desktop.
public class Program
{
static void Main(string[] args)
{
Console.WriteLine(Run());
Console.ReadLine();
}
public static decimal Run()
{
decimal total = 0;
TaxCalculator calculator = new TaxCalculator1();
// Frequent calls to simulate performance hits
for (var i = 0; i < 5_000_000; i++)
{
total += calculator.CalculateTaxes();
}
calculator = new TaxCalculator2();
// Frequent calls to simulate performance hits
for (var i = 0; i < 5_000_000; i++)
{
total += calculator.CalculateTaxes();
}
return total;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment