[IronPython] Execfile in IronPython 2.0 slower then 1.1

Dino Viehland dinov at microsoft.com
Thu May 14 19:44:09 CEST 2009


I believe there's a code gen issue here w/ the DLR.  In 1.x we generate 
3 local variables in the gigantic method that this ends up generating. 

In 2.0 we generate a bigger method but more importantly we're generating
10002 local variables which causes the JIT to spend a long time analyzing
those locals (nearly 60% of the time is spent in one function in the JIT
doing variable analysis while over 80% of the time is spent JITing).

In the 2.6 branch this issue is already mitigated because we will no 
longer compile modules (unless they're pre-compiled of course) - we now 
interpret them instead.  That makes a lot more sense for top level code
which only executes once but you'd still hit this problem if you put
it into a method and then executed that method several times.  But I'll
report this issue to the DLR team as they should be able to share
locals instead of creating new ones over and over again.

Thanks for bringing this up it's a nice scenario we're handling quite
poorly.

> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-
> bounces at lists.ironpython.com] On Behalf Of Cenovsky, Lukas
> Sent: Thursday, May 14, 2009 2:36 AM
> To: users at lists.ironpython.com
> Subject: [IronPython] Execfile in IronPython 2.0 slower then 1.1
> 
> I was playing yesterday with something and found that execfile is about
> 10 times slower in Ironpython 2.0 then in 1.1.
> Does anyone have an idea why?
> 
> Here is the snippet:
> 
> from time import time
> f = open('test.txt', 'w')
> f.write('res = []\n')
> f.write("res.append({'1': 'one', '2': 'two'})\n"*10000)
> f.close()
> t = time()
> execfile('test.txt')
> print 'Execfile took:', time() - t
> 
> Ironpython 1.1:
> Execfile took: 5.37503814697
> 
> Ironpython 2.0:
> Execfile took: 50.3440628052
> 
> PS: I know the example is stupid - I'm just wondering why such
> difference?
> 
> --
> -- Lukas
> 
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com




More information about the Ironpython-users mailing list