[IronPython] Sin and Sqrt performance
Chris Trimble
trimbo at gmail.com
Mon Apr 17 20:47:35 CEST 2006
IP doesn't do much better than CPython when using math.sin and
math.sqrt. However, same test in C# dominates (10ms.. as opposed to
upwards of 5 seconds in IP or CPy). Am I missing something here?
Thanks,
- Chris
-----------------------------------
import time
from math import *
def do_timing(f, reps):
start = time.time()
f(reps)
end = time.time()
print "%s (%d reps): %f" % (f.__name__, reps, end-start)
def py_fpfunc_test(reps):
j = 0.0
for i in range(0, reps):
j += sin( j )
j += sqrt( j )
j +=2.72392032032;
print j
def do_all_timing():
do_timing(py_fpfunc_test, 5000000)
do_all_timing()
print ""
More information about the Ironpython-users
mailing list