[Distutils] namespace packages
David Cournapeau
cournape at gmail.com
Fri Apr 23 13:38:13 CEST 2010
On Fri, Apr 23, 2010 at 7:16 PM, Tarek Ziadé <ziade.tarek at gmail.com> wrote:
> But guessing is not the right thing to do for optimization, we need facts.
> So if you come back with some profiling information on your use case
> where it seems so slow
Here is what cProfile -s cum gives me for a script which only import
pkg_resources:
42208 function calls (41959 primitive calls) in 0.421 CPU seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.421 0.421 <string>:1(<module>)
1 0.000 0.000 0.421 0.421 {execfile}
1 0.003 0.003 0.421 0.421 yo.py:1(<module>)
1 0.008 0.008 0.418 0.418 pkg_resources.py:14(<module>)
1 0.001 0.001 0.232 0.232 pkg_resources.py:673(subscribe)
93 0.001 0.000 0.231 0.002 pkg_resources.py:2623(<lambda>)
93 0.003 0.000 0.230 0.002 pkg_resources.py:2166(activate)
257 0.005 0.000 0.192 0.001 pkg_resources.py:1743(_handle_ns)
253 0.008 0.000 0.160 0.001 pkgutil.py:176(find_module)
275 0.024 0.000 0.151 0.001 posixpath.py:351(realpath)
36 0.003 0.000 0.138 0.004 pkg_resources.py:428(add_entry)
94 0.002 0.000 0.137 0.001 {map}
93 0.003 0.000 0.133 0.001
pkg_resources.py:1795(fixup_namespace_packages)
230 0.022 0.000 0.110 0.000
pkg_resources.py:1686(find_on_path)
1 0.000 0.000 0.078 0.078 pkg_resources.py:414(__init__)
30/23 0.001 0.000 0.064 0.003
pkg_resources.py:1764(declare_namespace)
1518 0.036 0.000 0.059 0.000 posixpath.py:59(join)
196 0.008 0.000 0.044 0.000
pkg_resources.py:2068(from_location)
1206 0.014 0.000 0.043 0.000 posixpath.py:129(islink)
402 0.004 0.000 0.042 0.000 re.py:229(_compile)
13 0.000 0.000 0.036 0.003 sre_compile.py:501(compile)
12 0.000 0.000 0.035 0.003 re.py:188(compile)
196 0.006 0.000 0.027 0.000 pkg_resources.py:2054(__init__)
275 0.003 0.000 0.026 0.000 posixpath.py:337(abspath)
275 0.012 0.000 0.020 0.000 posixpath.py:308(normpath)
1738 0.005 0.000 0.020 0.000
pkg_resources.py:1831(_normalize_cached)
196 0.008 0.000 0.019 0.000 pkg_resources.py:506(add)
13 0.000 0.000 0.019 0.001 sre_parse.py:669(parse)
1206 0.019 0.000 0.019 0.000 {posix.lstat}
36/13 0.001 0.000 0.018 0.001 sre_parse.py:307(_parse_sub)
93 0.010 0.000 0.018 0.000 pkg_resources.py:2257(insert_on)
44/13 0.006 0.000 0.018 0.001 sre_parse.py:385(_parse)
5839 0.017 0.000 0.017 0.000 {method 'endswith' of
'str' objects}
5173 0.017 0.000 0.017 0.000 {method 'startswith' of
'str' objects}
390 0.004 0.000 0.016 0.000 re.py:144(sub)
13 0.000 0.000 0.016 0.001 sre_compile.py:486(_code)
22 0.000 0.000 0.015 0.001
pkg_resources.py:1827(normalize_path)
253 0.014 0.000 0.014 0.000 {imp.find_module}
99 0.001 0.000 0.013 0.000
pkg_resources.py:2537(_find_adapter)
196 0.001 0.000 0.011 0.000 pkg_resources.py:1108(safe_name)
85/13 0.005 0.000 0.011 0.001 sre_compile.py:38(_compile)
228 0.003 0.000 0.011 0.000 genericpath.py:38(isdir)
99 0.010 0.000 0.011 0.000 pkg_resources.py:2530(_get_mro)
116 0.002 0.000 0.011 0.000
pkg_resources.py:2161(_get_metadata)
1196 0.007 0.000 0.011 0.000 stat.py:55(S_ISLNK)
194 0.002 0.000 0.010 0.000
pkg_resources.py:1116(safe_version)
568 0.006 0.000 0.009 0.000 pkg_resources.py:2098(key)
63 0.001 0.000 0.008 0.000
pkg_resources.py:1805(file_ns_handler)
let me know if you need more info,
cheers,
David
More information about the Distutils-SIG
mailing list