Exemplo n.º 1
0
        static void Main(string[] args)
        {
            New <Test> .Compile();

            Stopwatch benchmark = Stopwatch.StartNew();

            for (int i = 0; i < 100000; i++)
            {
                var result = New <Test> .Instance();//Type<Test>.New();
            }
            benchmark.Stop();
            Console.WriteLine(benchmark.ElapsedMilliseconds + " Type<Test>.New()");

            benchmark = Stopwatch.StartNew();
            for (int i = 0; i < 100000; i++)
            {
                System.Activator.CreateInstance <Test>();
            }
            benchmark.Stop();
            Console.WriteLine(benchmark.ElapsedMilliseconds + " System.Activator.CreateInstance<Test>();");
            Console.Read();
        }
Exemplo n.º 2
0
 internal void Prepare()
 {
     New <T> .Compile();
 }