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());
}
}
}
I try the above in C# 3.5 using IPY 2.0 and IPY 2.6. I find IPY 2.6 to be more than an order of magnitude slower. This is most probably programmer error. Any help would be appreciated.