##// END OF EJS Templates
fixed JSONWriter handling Infinity, NaN and locale aware number formatting
fixed JSONWriter handling Infinity, NaN and locale aware number formatting

File last commit:

r138:f75cfa58e3d4 v2
r142:2100965eb97f v2
Show More
Program.cs
93 lines | 2.8 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
shared locks + tests
r136 using System.Threading;
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 t1 = Environment.TickCount;
cin
improved tracing...
r93
cin
shared locks + tests
r136 const int reads = 100000;
const int writes = 1000;
const int readThreads = 8;
const int writeThreads = 0;
var l = new SharedLock();
var st = new HashSet<int>();
cin
improved performance of promises
r125
cin
shared locks + tests
r136 Action reader1 = () => {
for (int i =0; i < reads; i++) {
try {
l.LockShared();
st.Contains(i % 1000);
Thread.Sleep(0);
} finally {
l.Release();
}
}
};
Action reader2 = () => {
for(var i = 0; i < reads; i++)
lock(st) {
st.Contains(i % 1000);
Thread.Sleep(0);
}
};
cin
improved tracing...
r93
cin
shared locks + tests
r136 Action writer1 = () => {
var rnd = new Random(Environment.TickCount);
for (int i = 0; i < writes; i++) {
try {
l.LockExclusive();
st.Add(rnd.Next(1000));
//Thread.Sleep(1);
} finally {
l.Release();
}
}
};
cin
improved performance of promises
r125
cin
shared locks + tests
r136 Action writer2 = () => {
var rnd = new Random(Environment.TickCount);
for (int i = 0; i < writes; i++) {
lock (st) {
st.Add(rnd.Next(1000));
//Thread.Sleep(1);
}
}
};
cin
improved performance of promises
r125
cin
shared locks + tests
r136 var readers = new IPromise[readThreads];
for (int i = 0; i < readThreads; i++)
cin
added ICancellable.Cancel(Exception) to allow specify the reason of cancellation
r138 readers[i] = AsyncPool.RunThread(reader2);
cin
shared locks + tests
r136
var writers = new IPromise[writeThreads];
for (int i = 0; i < writeThreads; i++)
writers[i] = AsyncPool.RunThread(writer1);
new [] {
readers.Bundle().On(() => Console.WriteLine("readers complete in {0} ms", Environment.TickCount - t1)),
writers.Bundle().On(() => Console.WriteLine("writers complete in {0} ms", Environment.TickCount - t1))
}.Bundle().Join();
cin
working version of AsyncQueue and batch operations...
r121
cin
sync
r103 var t2 = Environment.TickCount;
cin
improved performance of promises
r125 Console.WriteLine("done: {0} ms, {1:.00} Mb, {2} GC", t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0) );
cin
improved tracing...
r93
}
cin
shared locks + tests
r136
cin
improved tracing...
r93 }
}