New submission from INADA Naoki:
abs_paths() is the another most slow parts of site module.
We can speedup it if we have C implementation of os.path.abspath() or
abs_paths().
But before trying it, is abs_paths() really needed for now?
It only rewrite `__file__` and `__cached__` of modules imported before site is
imported.
What is difference between modules loaded befere / after site module?
Here is profile output. sysconfig dependency is removed by #29585 patch, and
pstat is modified
to show time in ms instead of sec.
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
3/1 0.004 0.001 2.525 2.525 {built-in method builtins.exec}
1 0.003 0.003 2.524 2.524 x.py:1(<module>)
1 0.010 0.010 1.806 1.806 site.py:555(main)
4/3 0.022 0.005 1.179 0.393 <frozen
importlib._bootstrap>:958(_find_and_load)
4/3 0.017 0.004 1.110 0.370 <frozen
importlib._bootstrap>:931(_find_and_load_unlocked)
1 0.195 0.195 0.928 0.928 site.py:99(abs_paths)
108 0.098 0.001 0.776 0.007 posixpath.py:367(abspath)
4 0.035 0.009 0.647 0.162 <frozen
importlib._bootstrap>:861(_find_spec)
4 0.005 0.001 0.589 0.147 <frozen
importlib._bootstrap_external>:1150(find_spec)
4 0.043 0.011 0.584 0.146 <frozen
importlib._bootstrap_external>:1118(_get_spec)
2/1 0.012 0.006 0.557 0.557 <frozen
importlib._bootstrap>:641(_load_unlocked)
2/1 0.006 0.003 0.511 0.511 <frozen
importlib._bootstrap_external>:673(exec_module)
108 0.461 0.004 0.493 0.005 posixpath.py:329(normpath)
16 0.150 0.009 0.453 0.028 <frozen
importlib._bootstrap_external>:1234(find_spec)
----------
components: Library (Lib)
messages: 288019
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: abs_paths() in site.py is slow
type: performance
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29592>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com