This same program in interpreted C# or Java (as opposed to JITed) runs
about the same speed as CPython (~110ms on my machine).  IronPython
takes almost 3 seconds in the inner loops.  Any ideas why?

IronPy version:
------------------------
import System

kTotalReps = 800
kNumReps = 100

start = System.Environment.TickCount
blah = 0
randgen = System.Random()
highnum = 0.0
for i in range(kTotalReps):
        myt = []
        for j in range(kNumReps):
                toadd = randgen.NextDouble()
                myt.append(toadd)
                highnum = max(highnum, toadd)
                blah = blah + 1

print blah
print highnum
print (System.Environment.TickCount-start)
----------------------


CPy version:
----------------------
import time
import random

kTotalReps = 800
kNumReps = 100

start = time.time()
blah = 0
highnum = 0.0
for i in range(kTotalReps):
        myt = []
        for j in range(kNumReps):
                toadd = random.random()
                myt.append(toadd)
                highnum = max(highnum, toadd)
                blah = blah + 1

print blah
print highnum
print (time.time()-start)*1000
-----------------------
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to