annotate Implab.Playground/Program.cs @ 266:254d1f255d87 v3

Добавлена метка v3.0.10 для набора изменений 74e048cbaac8
author cin
date Mon, 16 Apr 2018 19:45:18 +0300
parents 547a2fc0d93e
children 6b3e5c48131b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
1 using Implab.Diagnostics;
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
2 using Implab.Formats.Json;
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
3 using Implab.Parallels;
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
4 using Implab.Xml;
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
5 using System;
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
6 using System.Collections.Concurrent;
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
7 using System.Collections.Generic;
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
8 using System.IO;
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
9 using System.Linq;
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
10 using System.Text;
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
11 using System.Threading;
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
12 using System.Threading.Tasks;
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
13 using System.Xml;
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
14 using System.Xml.Serialization;
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
15
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
16 namespace Implab.Playground {
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
17 using System.Diagnostics;
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
18 using static Trace<Program>;
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
19
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
20 public class Program {
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
21
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
22 static void Main(string[] args) {
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
23 var listener = new SimpleTraceListener(Console.Out);
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
24
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
25 var source = Trace<Program>.TraceSource;
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
26 source.Switch.Level = SourceLevels.All;
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
27
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
28 source.Listeners.Add(listener);
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
29
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
30 var t = Environment.TickCount;
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
31
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
32 Main().Wait();
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
33
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
34 Console.WriteLine($"Done: {Environment.TickCount - t} ms");
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
35 Console.ReadKey();
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
36 }
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
37
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
38 static async Task Main() {
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
39 using (LogicalOperation(nameof(Main))) {
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
40 Log("Start");
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
41 await SomeAsync();
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
42 Log("End");
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
43 }
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
44 }
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
45
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
46 static async Task SomeAsync() {
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
47 using (LogicalOperation(nameof(SomeAsync))) {
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
48 Log("Do prepare");
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
49 await Task.Yield();
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
50 Log("Yield");
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
51 }
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
52 }
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
53 }
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
54 }