Skip to content

Instantly share code, notes, and snippets.

@Extred
Last active June 21, 2018 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Extred/9a7c827d3538b2bbc1bd2be50e4ecbee to your computer and use it in GitHub Desktop.
Save Extred/9a7c827d3538b2bbc1bd2be50e4ecbee to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
using System.Threading;
namespace wx_test
{
class Program
{
static string lettersGOOD = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static string lettersBAD = ".-%&?ABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static void Go(string sample, int iterations)
{
for (int i = 0; i < iterations; i++)
{
sample.StartsWith("SI");
}
}
static void Main(string[] args)
{
var cult = Thread.CurrentThread.CurrentCulture;
Console.WriteLine($"{cult}; {cult.CompareInfo}");
Go(lettersGOOD, 1);
Go(lettersBAD, 1);
var stopwatch = Stopwatch.StartNew();
Go(lettersGOOD, 1000000);
stopwatch.Stop();
Console.WriteLine($"GOOD: {stopwatch.Elapsed}");
stopwatch = Stopwatch.StartNew();
Go(lettersBAD, 1000000);
stopwatch.Stop();
Console.WriteLine($"BAD: {stopwatch.Elapsed}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment