Created
October 18, 2012 13:50
-
-
Save alfeg/3911956 to your computer and use it in GitHub Desktop.
GUIDs generation performance test JFF
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
18.10.2012 13:49:09: Starting generating of GUIDs | |
Time : Number of GUIDs | |
0: 0 | |
175: 1200000 | |
351: 2400000 | |
520: 3600000 | |
689: 4800000 | |
860: 6000000 | |
1030: 7200000 | |
1200: 8400000 | |
1370: 9600000 | |
1539: 10800000 | |
1709: 12000000 | |
1878: 13200000 | |
2047: 14400000 | |
2217: 15600000 | |
2388: 16800000 | |
2557: 18000000 | |
2727: 19200000 | |
2896: 20400000 | |
3066: 21600000 | |
3234: 22800000 | |
3404: 24000000 | |
3573: 25200000 | |
3742: 26400000 | |
3912: 27600000 | |
4082: 28800000 | |
4252: 30000000 | |
4421: 31200000 | |
4590: 32400000 | |
4759: 33600000 | |
4928: 34800000 | |
5097: 36000000 | |
5267: 37200000 | |
5436: 38400000 | |
5604: 39600000 | |
5774: 40800000 | |
5944: 42000000 | |
6113: 43200000 | |
6282: 44400000 | |
6452: 45600000 | |
6621: 46800000 | |
6790: 48000000 | |
6960: 49200000 | |
7129: 50400000 | |
7298: 51600000 | |
7467: 52800000 | |
7636: 54000000 | |
7805: 55200000 | |
7976: 56400000 | |
8145: 57600000 | |
8314: 58800000 | |
8483: 60000000 | |
8652: 61200000 | |
8821: 62400000 | |
8992: 63600000 | |
9162: 64800000 | |
9331: 66000000 | |
9501: 67200000 | |
9670: 68400000 | |
9840: 69600000 | |
10010: 70800000 | |
10179: 72000000 | |
10349: 73200000 | |
10518: 74400000 | |
10687: 75600000 | |
10857: 76800000 | |
11027: 78000000 | |
11196: 79200000 | |
11366: 80400000 | |
11535: 81600000 | |
11705: 82800000 | |
11874: 84000000 | |
12044: 85200000 | |
12213: 86400000 | |
12384: 87600000 | |
12553: 88800000 | |
12723: 90000000 | |
12892: 91200000 | |
13062: 92400000 | |
13231: 93600000 | |
13401: 94800000 | |
13569: 96000000 | |
13738: 97200000 | |
13907: 98400000 | |
14077: 99600000 | |
14247: 100800000 | |
14416: 102000000 | |
14585: 103200000 | |
14754: 104400000 | |
14924: 105600000 | |
15094: 106800000 | |
15265: 108000000 | |
15441: 109200000 | |
15616: 110400000 | |
15790: 111600000 | |
15965: 112800000 | |
16140: 114000000 | |
16316: 115200000 | |
16492: 116400000 | |
16668: 117600000 | |
16841: 118800000 | |
Took 17016ms to generate 120000000 Guids 7058823guids/s |
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
private static void Main(string[] args) | |
{ | |
Console.WriteLine("Will generate 70M of Guids.\n\r Flushing timestamps for each 100k guids in one thread"); | |
long i = 0; | |
long max = 120 * 1000000; | |
long quant = max / 100l; | |
var list = new Guid[max]; | |
using (var file = File.AppendText("stats.log")) | |
{ | |
file.WriteLine("{0}: Starting generating of GUIDs", DateTime.UtcNow); | |
file.WriteLine("Time : Number of GUIDs"); | |
var sw = new Stopwatch(); | |
sw.Start(); | |
while (i < max) | |
{ | |
if (i % quant == 0) | |
{ | |
var message = string.Format("{0}: {1}", sw.ElapsedMilliseconds, i); | |
file.WriteLineAsync(message); | |
Console.WriteLine(message); | |
} | |
list[i] = Guid.NewGuid(); | |
i++; | |
} | |
Console.WriteLine("Took {0}ms to generate {1} Guids {2}guids/s", sw.ElapsedMilliseconds, i, i/sw.Elapsed.Seconds); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment