码迷,mamicode.com
首页 > 其他好文 > 详细

Ioc 比较

时间:2014-08-05 18:30:29      阅读:297      评论:0      收藏:0      [点我收藏+]

标签: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");
                }

bubuko.com,布布扣

 

 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");
                }

 

bubuko.com,布布扣

Ioc 比较,布布扣,bubuko.com

Ioc 比较

标签:blog   http   os   io   for   2014   art   ar   

原文地址:http://www.cnblogs.com/yipeng-yu/p/3892621.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!