##// END OF EJS Templates
refactoring, moving to dotnercore, simplifying promises
refactoring, moving to dotnercore, simplifying promises

File last commit:

r236:302ca905c19e v2
r240:fa6cbf4d8841 v3
Show More
Program.cs
92 lines | 2.9 KiB | text/x-csharp | CSharpLexer
cin
JsonXmlReader performance tuning...
r229 using Implab.Formats.Json;
cin
Improved AsyncQueue...
r233 using Implab.Parallels;
cin
JsonXmlReader performance tuning...
r229 using Implab.Xml;
using System;
cin
Improved AsyncQueue...
r233 using System.Collections.Concurrent;
cin
JsonXmlReader performance tuning...
r229 using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
cin
Improved AsyncQueue...
r233 using System.Threading;
cin
JsonXmlReader performance tuning...
r229 using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace Implab.Playground {
public class Program {
cin
Improved AsyncQueue...
r233 static void EnqueueRange<T>(ConcurrentQueue<T> q, T[] data, int offset, int len) {
for (var i = offset; i < offset + len; i++)
q.Enqueue(data[i]);
}
static bool TryDequeueRange<T>(ConcurrentQueue<T> q,T[] buffer,int offset, int len, out int actual) {
actual = 0;
T res;
while(q.TryDequeue(out res)) {
buffer[offset + actual] = res;
actual++;
if (actual == len)
break;
}
return actual != 0;
}
static void EnqueueRange<T>(SimpleAsyncQueue<T> q, T[] data, int offset, int len) {
for (var i = offset; i < offset + len; i++)
q.Enqueue(data[i]);
}
cin
JsonXmlReader performance tuning...
r229
cin
Improved AsyncQueue...
r233 static bool TryDequeueRange<T>(SimpleAsyncQueue<T> q, T[] buffer, int offset, int len, out int actual) {
actual = 0;
T res;
while (q.TryDequeue(out res)) {
buffer[offset + actual] = res;
actual++;
if (actual == len)
break;
}
return actual != 0;
}
cin
JsonXmlReader performance tuning...
r229
cin
Improved AsyncQueue...
r233 static void EnqueueRange<T>(AsyncQueue<T> q, T[] data, int offset, int len) {
for (var i = offset; i < offset + len; i++)
q.Enqueue(data[i]);
}
cin
JsonXmlReader performance tuning...
r229
cin
Improved AsyncQueue...
r233 static bool TryDequeueRange<T>(AsyncQueue<T> q, T[] buffer, int offset, int len, out int actual) {
actual = 0;
T res;
while (q.TryDequeue(out res)) {
buffer[offset + actual] = res;
actual++;
if (actual == len)
break;
}
return actual != 0;
}
cin
Added implab nuget spec
r234
cin
Improved AsyncQueue...
r233
cin
Added implab nuget spec
r234 /*static void EnqueueRange<T>(AsyncQueue<T> q, T[] data, int offset, int len) {
cin
Improved AsyncQueue...
r233 q.EnqueueRange(data, offset, len);
cin
JsonXmlReader performance tuning...
r229 }
cin
Improved AsyncQueue...
r233 static bool TryDequeueRange<T>(AsyncQueue<T> q, T[] buffer, int offset, int len, out int actual) {
return q.TryDequeueRange(buffer, offset, len, out actual);
cin
Added implab nuget spec
r234 }*/
cin
Improved AsyncQueue...
r233
cin
JsonXmlReader performance tuning...
r229 static void Main(string[] args) {
cin
JsonReader optimizations
r236 var t = Environment.TickCount;
using (var reader = JsonReader.Create("e:\\citylots.json")) {
while (reader.Read()) {
}
}
Console.WriteLine($"JsonReader: {Environment.TickCount - t} ms");
cin
JsonXmlReader performance tuning...
r229
Console.WriteLine("done");
}
}
}