title: IronPython vs Python speed with numpy
body: <p>I have some Python source code that manipulates lists of lists of numbers (say about 10,000 floating point numbers) and does various calculations on these numbers, including a lot of numpy.linalg.norm for example.  </p>
  
  <p>Run time had not been an issue until we recently started using this code from a C# UI (running this Python code from C# via IronPython).  I extracted a set of function calls (doing things as described in the 1st paragraph) and found that this code takes about 4x longer to run in IronPython compared to Python 2.7 (and this is after excluding the startup/setup time in C#/IronPython).  I'm using a C# stopwatch around the repeated IronPython calls from C# and using the timeit module around an execfile in Python 2.7 (so the Python time results include more operation like loading the file, creating the objects, ... whereas the C# doesn't).  The former requires about 4.0 seconds while the latter takes about 0.9 seconds.</p>
  
  <p>Would you expect this kind of difference?  Any ideas how I might resolve this issue?  Other comments?</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>Here is a simple example of code that runs about 10x slower on IronPython on my machine (4 seconds in Python 2.7 and 40 seconds in IronPython):</p>
  
  <pre><code>n = 700
  for i in range(n-1):
      for j in range(i, n):
          dist = np.linalg.norm(np.array([i, i, i]) - np.array([j, j, j]))
  </code></pre>