Last active
February 17, 2022 14:40
-
-
Save zxsanny/75849bbd98129612c9f87bc5dd06b187 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
TimeSpan PerformanceTest(Action action, int repeats) | |
{ | |
var sw = new Stopwatch(); | |
sw.Start(); | |
for (int i = 0; i < repeats; i++) | |
action(); | |
sw.Stop(); | |
return sw.Elapsed; | |
} | |
(TimeSpan action1, TimeSpan action2) ComparePerformanceTest(Action action1, Action action2, int repeats) => | |
(PerformanceTest(action1, repeats), PerformanceTest(action2, repeats)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment