Created
June 26, 2022 10:49
-
-
Save AhmedTarekHasan/dbde0a300de802fe9ccb9054908a15da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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