Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            InitArray();
            PerformanceTest.InitInternals();
//			GC ();
            Console.WriteLine("Performance measuring starting");

            //You can call it directly in AOT mode
//			for (int i = 0; i < 5; i++) {
//				Performance ();
//			}

            //This is workaround for mono bug/feature
            //When mono started it tries to compile 'Main' and recursively
            //all methods, which are called from 'Main' method
            //And in our case it compiles managed_to_native wrapper for our Internal Call methods
            //which are not registred yet by 'InitInternal'. (We are expecting to register icalls
            //first and only after compile them). In this case JIT cannot find icall entry points,
            //generates 'MissingMethodException' body for managed_to_native wrapper and cashes it.
            //When we register new icall entry later we can't regenerate wrapper or remove it from
            //the wrapper's cache.
            //To workaround this behaviour we hide our functions from JIT by calling them through
            //delegate
            //By the way in AOT mode you don't need to use such workaround all works out of the box.
            HideFromJit d = Performance;

            for (int i = 0; i < 5; i++)
            {
                d();
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            InitArray();
            PerformanceTest.InitInternals();

            Console.WriteLine("Performance measuring starting");

            HideFromJit d = Performance;

            for (int i = 0; i < 5; i++)
            {
                d();
            }
        }