using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IronPython;
using IronPython.Hosting;
namespace EmbeddedIP2_6
{
class Program
{
static void Main(string[] args)
{
var engine = Python.CreateEngine();
var ss = engine.CreateScriptSourceFromString("B", Microsoft.Scripting.SourceCodeKind.Expression);
var cc = ss.Compile();
var timer = System.Diagnostics.Stopwatch.StartNew();
timer.Start();
for (int i = 0; i < 10000; i++)
{
var scope = engine.CreateScope();
scope.SetVariable("B", 2);
var value = cc.Execute(scope);
}
timer.Stop();
System.Console.WriteLine(timer.Elapsed.ToString());
}
}
}
위의 C# 3.5에서 IPY 2.0 및 IPY 2.6을 사용합니다. 필자는 IPY 2.6이 몇 배 이상 느려지는 것을 발견했다. 이것은 아마도 프로그래머 오류 일 것입니다. 어떤 도움을 주시면 감사하겠습니다. 현재 IronPython 2.6의 속도가 2.0보다 느립니다.
당신이 말할 수 없습니다 스크립트를 실행 범위
- : 당신은 루프 내에서 세 가지를하고있는
중요하지는 않지만'StartNew' 이후에는'Start'가 중복됩니다. –