93
|
1 using System;
|
|
2 using Implab.Diagnostics;
|
|
3 using Implab.Parallels;
|
|
4 using Implab;
|
103
|
5 using System.Collections.Generic;
|
|
6 using System.Collections.Concurrent;
|
136
|
7 using System.Threading;
|
93
|
8
|
|
9 namespace MonoPlay {
|
|
10 class MainClass {
|
145
|
11
|
|
12
|
93
|
13 public static void Main(string[] args) {
|
94
|
14 if (args == null)
|
|
15 throw new ArgumentNullException("args");
|
|
16
|
103
|
17 var t1 = Environment.TickCount;
|
93
|
18
|
145
|
19 for (int i = 0; i < 10000000; i++) {
|
|
20
|
|
21 var p = new Promise<int>();
|
|
22 p.On(HandleResult);
|
|
23 p.Resolve(i);
|
|
24 }
|
121
|
25
|
103
|
26 var t2 = Environment.TickCount;
|
125
|
27 Console.WriteLine("done: {0} ms, {1:.00} Mb, {2} GC", t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0) );
|
93
|
28
|
|
29 }
|
136
|
30
|
145
|
31 static void HandleAction ()
|
|
32 {
|
|
33
|
|
34 }
|
136
|
35
|
145
|
36 static void HandleResult(int x) {
|
|
37
|
|
38 }
|
93
|
39 }
|
|
40 }
|