I am running into some performance problems with IronPython inside of VS2010 while trying to import and use SymPy.
I have an IronPython test project containing the following code:
import time
print 'StandaloneIronPython'
startTime = time.time()
from sympy import *
importTime = time.time() - startTime
print 'Import time = %f' % importTime
startTime = time.time()
for x in (x/10.0 for x in xrange(-100,100)):
(x**2-2*x)
numericsTime = time.time() - startTime
print 'Basic numerics time= %f' % numericsTime
startTime = time.time()
for x in (x/10.0 for x in xrange(-100,100)):
N(x**2-2*x)
sympyTime = time.time() - startTime
print 'SymPy time = %f' % sympyTime
raw_input('Press enter to continue...')
SymPy was downloaded and installed as an egg; my "IronPython 2.7\Lib\site-packages" folder is in the project Search Path.
If I run the program via "Debug > Start Debugging" I get approximately this:
StandaloneIronPython
Import time = 12.090019
Basic numerics time= 0.015594
SymPy time = 2.230804
Press enter to continue...
If, however, I run the program via "Debug > Start Without Debugging" I get approximately:
StandaloneIronPython
Import time = 2.199600
Basic numerics time= 0.015602
SymPy time = 0.140404
Press enter to continue...
I get ~5 times the speed importing and >10 times the speed running sympy.
So how can I get good performance out of IronPython if it's spending all its time debugging library code?
- Is there a way that I can bundle up SymPy as a library, assembly, or something else such that it will perform quickly?
- Is there a way to tell VS2010 not to debug the code for SymPy?
- Is there some other sort of solution?