-
-
Save kkozmic/8362bc57f24d7adf68e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AttributesToAvoidReplicating.Add<MarshalAsAttribute>(); | |
var pg = new ProxyGenerator(); | |
var tasks = new List<Task>(); | |
var interfaces = | |
typeof (object).Assembly.GetExportedTypes() | |
.Where(t => t.IsInterface && t.IsGenericTypeDefinition == false) | |
.OrderBy(t => t.Name).Take(10); | |
for (int _ = 0; _ < 100; _++) | |
{ | |
foreach (var @interface in interfaces) | |
{ | |
var i = @interface; | |
tasks.Add(new Task(() => pg.CreateInterfaceProxyWithoutTarget(i))); | |
} | |
} | |
var allTasks = tasks.ToArray(); | |
var sw = Stopwatch.StartNew(); | |
Array.ForEach(allTasks, t => t.Start()); | |
Task.WaitAll(allTasks); | |
Console.WriteLine(); | |
Console.WriteLine("All done in " + sw.ElapsedMilliseconds + "ms"); | |
Console.ReadKey(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment