标签:blog http os io for 2014 art ar
/// <summary>
/// install-package Ninject
/// install-package autofac
/// install-package Munq.IocContainer
/// install-package Unity
/// </summary>
static void Cost(string ioc,Action action) { var stopwatch = new Stopwatch(); stopwatch.Start(); for (int i=0;i<10000;i++) { action(); } stopwatch.Stop(); var ticks = stopwatch.ElapsedMilliseconds; Console.WriteLine(ioc + ": " + (ticks / 1000.00).ToString()+" ms"); }
static void Cost(string ioc,Action action) { var stopwatch = new Stopwatch(); stopwatch.Start(); for (int i=0;i<10000;i++) { Task.Run(action); // 换成多线程 } stopwatch.Stop(); var ticks = stopwatch.ElapsedMilliseconds; Console.WriteLine(ioc + ": " + (ticks / 1000.00).ToString()+" ms"); }
标签:blog http os io for 2014 art ar
原文地址:http://www.cnblogs.com/yipeng-yu/p/3892621.html