Created
August 4, 2015 02:15
-
-
Save sinairv/a4ece3453deb709fcacc to your computer and use it in GitHub Desktop.
Performance Measurement
This file contains hidden or 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
const int WarmUpCount = 3; | |
const int TestCount = 100; | |
var stopWatch = new Stopwatch(); | |
stopWatch.Reset(); | |
for (int i = 0; i < WarmUpCount + TestCount; i++) | |
{ | |
if(i >= WarmUpCount) | |
stopWatch.Start(); | |
var someVariable = FunctionCallToMeasure(); | |
if(i >= WarmUpCount) | |
stopWatch.Stop(); | |
} | |
var elapsed = stopWatch.ElapsedMilliseconds; | |
var averageRunTime = (decimal)elapsed/TestCount; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment