IronPython 1.0 - Bugs or Features?
Claudio Grondi
claudio.grondi at freenet.de
Thu Sep 7 09:54:41 EDT 2006
Super Spinner wrote:
> IronPython is a .NET language, so does that mean that it invokes the
> JIT before running actual code? If so, then "simple short scripts"
> would take longer with IronPython "busy starting itself" loading .NET
> and invoking the JIT. This effect would be less noticable, the longer
> the program is. But I'm just guessing; I've not used IronPython.
>
The time of loading IronPython seem to pay out at the end if the script
takes a longer time to run, so you are most probably right. I am a bit
surprised, that the difference is not that big (e.g. at least half the
time) as I have expected from a JIT concept ... :
<code>
# import psyco
# psyco.full()
def arccot(x, unity):
sum = xpower = unity // x
n = 3
sign = -1
while 1:
xpower = xpower // (x*x)
term = xpower // n
if not term:
break
sum += sign * term
sign = -sign
n += 2
return sum
def pi(digits):
print ' start of setting unity value ...',
unity = 10**(digits + 10)
print ' set unity value, starting arccot() ... ',
pi = 4 * (4*arccot(5, unity) - arccot(239, unity))
return pi // 10**10
f = file("pi-decimal-100000digits.out","wb")
f.write(str(pi(100000)))
print """
PC: Pentium 4, 2.8 GHz, Windows XP SP2
writing 100.000 digits of Pi to a file takes using:
CPython 2.4.2 : 2 min 41 s (of CPU time)
CPython+Psyco : 2 min 45 s (of CPU time)
IronPython 1.0 : 1 min 48 s (of CPU time)
"""
</code>
Claudio Grondi
More information about the Python-list
mailing list