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;
|
93
|
7
|
|
8 namespace MonoPlay {
|
|
9 class MainClass {
|
|
10 public static void Main(string[] args) {
|
94
|
11 if (args == null)
|
|
12 throw new ArgumentNullException("args");
|
|
13
|
103
|
14 const int count = 10000000;
|
|
15
|
|
16 var t1 = Environment.TickCount;
|
93
|
17
|
125
|
18 for (int i = 0; i < count; i++) {
|
|
19 var p = new Promise<int>();
|
|
20
|
|
21 p.On(x => {}).On(x => {});
|
93
|
22
|
125
|
23 p.Resolve(i);
|
|
24
|
|
25 }
|
|
26
|
|
27
|
121
|
28
|
103
|
29 var t2 = Environment.TickCount;
|
125
|
30 Console.WriteLine("done: {0} ms, {1:.00} Mb, {2} GC", t2 - t1, GC.GetTotalMemory(false) / (1024*1024), GC.CollectionCount(0) );
|
93
|
31
|
|
32 }
|
|
33 }
|
|
34 }
|