Re: [Python-Dev] inspect.py very slow under 2.5

2006-09-07 Thread Fernando Perez
Nick Coghlan wrote: > I've updated the patch on SF, and committed the fix (including PJE's and > Neal's comments) to the trunk. > > I'll backport it tomorrow night (assuming I don't hear any objections in the > meantime :). I just wanted to thank you all for taking the time to work on this, even

Re: [Python-Dev] inspect.py very slow under 2.5

2006-09-07 Thread Nick Coghlan
Ralf Schmitt wrote: > Nick Coghlan wrote: >> Good point. I modified the patch so it does the latter (it only calls >> getabspath() again for a module if the value of module.__file__ changes). > > with _filesbymodname[modname] = file changed to _filesbymodname[modname] > = f > it seems to work ok

Re: [Python-Dev] inspect.py very slow under 2.5

2006-09-06 Thread Ralf Schmitt
Nick Coghlan wrote: > Ralf Schmitt wrote: >> Nick Coghlan wrote: >>> It looks like the problem is the call to getabspath() in getmodule(). >>> This happens every time, even if the file name is already in the >>> modulesbyfile cache. This calls os.path.abspath() and >>> os.path.normpath() every t

Re: [Python-Dev] inspect.py very slow under 2.5

2006-09-06 Thread Nick Coghlan
Ralf Schmitt wrote: > Nick Coghlan wrote: >> >> It looks like the problem is the call to getabspath() in getmodule(). >> This happens every time, even if the file name is already in the >> modulesbyfile cache. This calls os.path.abspath() and >> os.path.normpath() every time that inspect.findsou

Re: [Python-Dev] inspect.py very slow under 2.5

2006-09-06 Thread Ralf Schmitt
Nick Coghlan wrote: > > It looks like the problem is the call to getabspath() in getmodule(). This > happens every time, even if the file name is already in the modulesbyfile > cache. This calls os.path.abspath() and os.path.normpath() every time that > inspect.findsource() is called. > > That

Re: [Python-Dev] inspect.py very slow under 2.5

2006-09-06 Thread Nick Coghlan
Ralf Schmitt wrote: > The problem seems to originate from the module=getmodule(object) in > findsource. If I outcomment that code (or rather do a module=None), > things seem to be back as normal. (linecache.getlines has been called > with a None module in python 2.4's inspect.py). It looks like

Re: [Python-Dev] inspect.py very slow under 2.5

2006-09-06 Thread Ralf Schmitt
Fernando Perez wrote: > > These enormous numbers of calls are the origin of the slowdown, and the more > modules have been imported, the worse it gets. --- /exp/lib/python2.5/inspect.py 2006-08-28 11:53:36.0 +0200 +++ inspect.py 2006-09-06 12:10:45.0 +0200 @@ -444,7 +444,8

[Python-Dev] inspect.py very slow under 2.5

2006-09-05 Thread Fernando Perez
Hi all, I know that the 2.5 release is extremely close, so this will probably be 2.5.1 material. I discussed it briefly with Guido at scipy'06, and he asked for some profile-based info, which I've only now had time to gather. I hope this will be of some use, as I think the problem is rather seri