Skip to content

Instantly share code, notes, and snippets.

@kumpera
Created December 13, 2013 17:07
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 kumpera/7947579 to your computer and use it in GitHub Desktop.
Save kumpera/7947579 to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics;
class Foo<T> {}
class Program
{
static string x = "1010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659" +
"1010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659" +
"1010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659" +
"1010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659" +
"1010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659" +
"1010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659" +
"1010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659101020383064965910102038306496591010203830649659";
static int Bench ()
{
int acc = 0;
for (int i = 0; i < 1000 * 1000; ++i)
acc += x.GetHashCode ();
return acc;
}
static void Main(string[] args)
{
var sw = Stopwatch.StartNew ();
Bench ();
sw.Stop ();
sw = Stopwatch.StartNew ();
Bench ();
sw.Stop ();
Console.WriteLine ("It took {0}ms", sw.ElapsedMilliseconds);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment