예제 #1
0
        public void TestGetPropertyPerformance(bool useCSharp)
        {
            IModel model;

            if (useCSharp)
            {
                model = new CSharpModel();
            }
            else
            {
                var pyModel = PythonEngine.ModuleFromString("module", @"
from clr import AddReference
AddReference(""System"")
AddReference(""Python.EmbeddingTest"")

from Python.EmbeddingTest import *

class PythonModel(TestPropertyAccess.IModel):
    __namespace__ = ""Python.EmbeddingTest""

    def __init__(self):
        self._indicator = TestPropertyAccess.Indicator()

    def InvokeModel(self):
        value = self._indicator.Current.Value
").GetAttr("PythonModel").Invoke();

                model = new ModelPythonWrapper(pyModel);
            }

            // jit
            model.InvokeModel();

            const int iterations = 5000000;
            var       stopwatch  = Stopwatch.StartNew();

            for (var i = 0; i < iterations; i++)
            {
                model.InvokeModel();
            }

            stopwatch.Stop();
            var thousandInvocationsPerSecond = iterations / 1000d / stopwatch.Elapsed.TotalSeconds;

            Console.WriteLine(
                $"Elapsed: {stopwatch.Elapsed.TotalMilliseconds}ms for {iterations} iterations. {thousandInvocationsPerSecond} KIPS");
        }
예제 #2
0
 public static void MethodDateTimeAndTimeSpan(CSharpModel pepe, Func <DateTime, DateTime> func, SomeEnu someEnu, double?jose = null, double?pinocho = null)
 {
     AssertErrorNotOccurred();
 }
예제 #3
0
 public static void MethodDateTimeAndTimeSpan(CSharpModel pepe, SomeEnu @someEnu, int integer, double?jose = null, double?pinocho = null)
 {
     AssertErrorNotOccurred();
 }