annotate MonoPlay/Program.cs @ 187:dd4a3590f9c6 ref20160224

Reworked cancelation handling, if the cancel handler isn't specified the OperationCanceledException will be handled by the error handler Any unhandled OperationCanceledException will cause the promise cancelation
author cin
date Tue, 19 Apr 2016 17:35:20 +0300
parents 4f82e0f161c3
children d45bdf510514
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
1 using System;
dc4942d09e74 improved tracing
cin
parents:
diff changeset
2 using Implab;
151
ec91a6dfa5b3 Added support for 'await' operator to promises
cin
parents: 150
diff changeset
3 using System.Threading.Tasks;
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
4 using Implab.Formats.JSON;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
5 using System.IO;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
6 using System.Text.Json;
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
7
dc4942d09e74 improved tracing
cin
parents:
diff changeset
8 namespace MonoPlay {
dc4942d09e74 improved tracing
cin
parents:
diff changeset
9 class MainClass {
145
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
10
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
11
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
12 public static void Main(string[] args) {
94
a43745f81f10 minor fixes
cin
parents: 93
diff changeset
13 if (args == null)
a43745f81f10 minor fixes
cin
parents: 93
diff changeset
14 throw new ArgumentNullException("args");
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
15 int t1, t2;
150
3258399cba83 JSONWriter improvements
cin
parents: 145
diff changeset
16
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
17 for (int i = 0; i < 2; i++) {
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
18 t1 = Environment.TickCount;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
19 int elements =0;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
20 using (var reader = new JSONParser(File.OpenText("/home/sergey/temp/citylots.json"))) {
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
21 while (reader.Read())
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
22 elements++;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
23 }
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
24
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
25 t2 = Environment.TickCount;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
26 Console.WriteLine("attempt {0} done: {1} ms, {2:.00} Mb, {3} GC, Elements: {4}",i+1, t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0), elements );
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
27 }
136
e9e7940c7d98 shared locks + tests
cin
parents: 125
diff changeset
28
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
29 Console.WriteLine("Syste.Text.Json");
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
30 var paraser = new JsonParser();
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
31 for (int i = 0; i < 2; i++) {
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
32 t1 = Environment.TickCount;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
33 using (var reader = File.OpenText("/home/sergey/temp/citylots.json")) {
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
34 paraser.Parse(reader);
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
35 }
150
3258399cba83 JSONWriter improvements
cin
parents: 145
diff changeset
36
183
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
37 t2 = Environment.TickCount;
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
38 Console.WriteLine("attempt {0} done: {1} ms, {2:.00} Mb, {3} GC, ",i+1, t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0));
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
39 }
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
40
4f82e0f161c3 fixed DFA optimization, JSON is fully functional
cin
parents: 156
diff changeset
41
145
706fccb85524 RC: cancellation support for promises + tests
cin
parents: 138
diff changeset
42 }
136
e9e7940c7d98 shared locks + tests
cin
parents: 125
diff changeset
43
93
dc4942d09e74 improved tracing
cin
parents:
diff changeset
44 }
dc4942d09e74 improved tracing
cin
parents:
diff changeset
45 }