##// END OF EJS Templates
sync
sync

File last commit:

r103:b3f5bc613905 v2
r103:b3f5bc613905 v2
Show More
Program.cs
48 lines | 1.2 KiB | text/x-csharp | CSharpLexer
cin
improved tracing...
r93 using System;
using Implab.Diagnostics;
using Implab.Parallels;
using Implab;
cin
sync
r103 using System.Collections.Generic;
using System.Collections.Concurrent;
cin
improved tracing...
r93
namespace MonoPlay {
class MainClass {
public static void Main(string[] args) {
cin
minor fixes
r94 if (args == null)
throw new ArgumentNullException("args");
cin
sync
r103 var q1 = new MTQueue<int>();
var q2 = new ConcurrentQueue<int>();
const int count = 10000000;
var t1 = Environment.TickCount;
cin
improved tracing...
r93
cin
sync
r103 for (var i = 0; i < count; i++)
q1.Enqueue(i);
cin
improved tracing...
r93
cin
sync
r103 var t2 = Environment.TickCount;
Console.WriteLine("MTQueue: {0} ms", t2 - t1);
t1 = Environment.TickCount;
cin
improved tracing...
r93
cin
sync
r103 for (var i = 0; i < count; i++)
q2.Enqueue(i);
t2 = Environment.TickCount;
Console.WriteLine("LinkedList: {0} ms", t2 - t1);
q2 = new ConcurrentQueue<int>();
cin
improved tracing...
r93
cin
sync
r103 t1 = Environment.TickCount;
for (var i = 0; i < count; i++)
lock (q2)
q2.Enqueue(i);
t2 = Environment.TickCount;
Console.WriteLine("LinkedList+Lock: {0} ms", t2 - t1);
cin
improved tracing...
r93
}
}
}