CSharp · Console
using System;
using System.Diagnostics;
public class Program
{
public static void Main(string[] args)
{
DoIt();
DoIt();
DoIt();
Console.Read();
}
public static void DoIt()
{
Stopwatch st = new Stopwatch();
st.Start();
for (int i = 0; i < 100; i++)
{
LessThanEqualTo();
}
st.Stop();
double avgTime = st.ElapsedMilliseconds / 100d;
Console.WriteLine("Less Than Equal To Method Time Elapsed: " + avgTime);
st.Reset();
st.Start();
for (int i = 0; i < 100; i++)
{
LessThan();
}
st.Stop();
avgTime = st.ElapsedMilliseconds / 100d;
Console.WriteLine("Less Than Method Time Elapsed: " + avgTime);
st.Reset();
}
public static void LessThanEqualTo()
{
for (int i = 0; i <= 1000000000; i++ )
{
}
}
public static void LessThan()
{
for (int i = 0; i < 1000000001; i++)
{
}
}
}