[issue29592] abs_paths() in site.py is slow

2017-03-24 Thread INADA Naoki
INADA Naoki added the comment: New changeset 2e4e011795d26cab1a3843383d0539c12fea2458 by INADA Naoki in branch 'master': bpo-29592: site: skip abs_paths() when it's redundant (GH-167) https://github.com/python/cpython/commit/2e4e011795d26cab1a3843383d0539c12fea2458 --

[issue29592] abs_paths() in site.py is slow

2017-03-14 Thread INADA Naoki
Changes by INADA Naoki : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___

[issue29592] abs_paths() in site.py is slow

2017-02-20 Thread Gregory P. Smith
Changes by Gregory P. Smith : -- nosy: +gregory.p.smith ___ Python tracker ___ ___

[issue29592] abs_paths() in site.py is slow

2017-02-19 Thread INADA Naoki
INADA Naoki added the comment: I got it. removeduppaths() may change relpath in sys.path to absolute path. abs_paths() changes __file__ and __cached__ for consistency with the changed sys.path. I updated PR 167 to call abs_paths() only if removeduppaths() modified sys.path. Strictly speaking,

[issue29592] abs_paths() in site.py is slow

2017-02-19 Thread Nick Coghlan
Nick Coghlan added the comment: Note that "os" doesn't get imported normally, it gets injected as part of the importlib bootstrapping process (since _bootstrap_external.py needs the os module in order to work). -- ___ Python tracker

[issue29592] abs_paths() in site.py is slow

2017-02-19 Thread Nick Coghlan
Nick Coghlan added the comment: CI failure indicating it isn't redundant, but could still potentially be made faster since non-absolute paths should be relatively rare now: == FAIL: test_s_option

[issue29592] abs_paths() in site.py is slow

2017-02-18 Thread Nick Coghlan
Nick Coghlan added the comment: Aye, I agree it should be redundant now - import system should always be making __file__ and __cached__ absolutely at import time these days. So +1 for dropping this from 3.7 and getting a bit of startup time back. --

[issue29592] abs_paths() in site.py is slow

2017-02-18 Thread INADA Naoki
Changes by INADA Naoki : -- pull_requests: +131 ___ Python tracker ___ ___

[issue29592] abs_paths() in site.py is slow

2017-02-17 Thread INADA Naoki
INADA Naoki added the comment: $ python2 -S Python 2.7.12+ (default, Sep 17 2016, 12:08:02) [GCC 6.2.0 20160914] on linux2 >>> import x >>> x.__file__ 'x.py' $ python3 -S Python 3.6.0 (default, Dec 30 2016, 20:49:54) [GCC 6.2.0 20161005] on linux >>> import x >>> x.__file__

[issue29592] abs_paths() in site.py is slow

2017-02-17 Thread INADA Naoki
INADA Naoki added the comment: https://github.com/python/cpython/blob/master/Lib/importlib/_bootstrap_external.py#L1089-L1095 While '' in sys.path, it is converted to `getcwd()` before calling PathHook. Is there any chance relative / not normalized path is in sys.path before site is loaded?

[issue29592] abs_paths() in site.py is slow

2017-02-17 Thread INADA Naoki
INADA Naoki added the comment: path normalization was added by https://github.com/python/cpython/commit/38cb9f1f174415d3b37fbaeb5d152d65525839d2 -- ___ Python tracker

[issue29592] abs_paths() in site.py is slow

2017-02-17 Thread INADA Naoki
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