This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年08月22日 14:49 by brett.cannon, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| less_stats.diff | brett.cannon, 2013年08月29日 17:58 | review | ||
| Messages (11) | |||
|---|---|---|---|
| msg195900 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年08月22日 14:49 | |
If the check was done based on simply the format what was being searched for (e.g. just assume it's a file if "module.py" exists in the directory) then a couple of stat calls per search could be saved. If that is deemed to dangerous due to backwards-compatibility, at least extract an API so people can skip the stat calls if they know they are not going to do something as silly as have something named module.py that is not a file. |
|||
| msg196018 - (view) | Author: Eric Snow (eric.snow) * (Python committer) | Date: 2013年08月23日 20:06 | |
Isn't this related somewhat to #7732? |
|||
| msg196044 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年08月23日 21:58 | |
I did a quick check and at least stripping out the two stat calls for a directory or module file (left in package __init__.py) didn't make a significant difference. |
|||
| msg196045 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年08月23日 21:59 | |
I don't think it's related to the test_imp bug, but since it was never fully diagnosed I couldn't tell you. |
|||
| msg196473 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年08月29日 17:58 | |
I also just tried using os.listdir() for a package before searching for __init__ and it didn't speed anything up either (actually timeit suggests that os.listdir() is worse than an isdir + 3 * isfile checks). Nor did caching directory stuff at the class level so that they were shared when an os.listdir() was done for an __init__ so that didn't have to be done a second time if the cache wasn't stale already. I have attached the patch with all of the changes to cut the number of stat calls down significantly, but benchmarking on my work machine shows no definitive benefit. |
|||
| msg200289 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年10月18日 17:24 | |
New changeset 11f2f4af1979 by Brett Cannon in branch 'default': Issue #18810: Be optimistic with stat calls when seeing if a directory http://hg.python.org/cpython/rev/11f2f4af1979 |
|||
| msg200291 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年10月18日 17:26 | |
The directory savings has actually been handled w/o semantics changes; in the last commit for this issue. The possibility of leaning on file extensions has been asked on python-dev. Once that is resolved then this issue will either get another commit or simply be closed. |
|||
| msg200292 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年10月18日 17:29 | |
New changeset 9895a9c20e8a by Brett Cannon in branch 'default': Add NEWS entry for issue #18810 http://hg.python.org/cpython/rev/9895a9c20e8a |
|||
| msg200419 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年10月19日 13:59 | |
Nick pointed out that the change to FileFinder is possibly going to break subclasses since the os module code doesn't treat '' as the cwd (which is unfortunate) and so people may have been relying on that never being the case. Really shouldn't matter all that much to the typical import though since PathFinder will still pass the full directory down to FileFinder. |
|||
| msg201904 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年11月01日 14:39 | |
Wrong issue |
|||
| msg201905 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年11月01日 14:40 | |
I'm going to go ahead and close this. I think the optimistic change is the only one worth making since it's backwards-compatible. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:49 | admin | set | github: 63010 |
| 2013年11月01日 14:40:20 | brett.cannon | set | status: open -> closed resolution: fixed stage: test needed -> resolved |
| 2013年11月01日 14:40:08 | brett.cannon | set | messages: + msg201905 |
| 2013年11月01日 14:39:36 | brett.cannon | set | dependencies:
- Restore empty string special casing in importlib.machinery.FileFinder messages: + msg201904 |
| 2013年11月01日 14:20:32 | brett.cannon | set | dependencies: + Restore empty string special casing in importlib.machinery.FileFinder |
| 2013年10月19日 18:09:36 | Arfrever | set | nosy:
+ Arfrever |
| 2013年10月19日 13:59:48 | brett.cannon | set | messages: + msg200419 |
| 2013年10月18日 17:29:32 | python-dev | set | messages: + msg200292 |
| 2013年10月18日 17:26:03 | brett.cannon | set | messages: + msg200291 |
| 2013年10月18日 17:24:43 | python-dev | set | nosy:
+ python-dev messages: + msg200289 |
| 2013年10月18日 14:23:34 | brett.cannon | set | assignee: brett.cannon |
| 2013年08月29日 17:58:07 | brett.cannon | set | files:
+ less_stats.diff keywords: + patch messages: + msg196473 |
| 2013年08月23日 21:59:12 | brett.cannon | set | messages: + msg196045 |
| 2013年08月23日 21:58:49 | brett.cannon | set | messages: + msg196044 |
| 2013年08月23日 20:06:18 | eric.snow | set | nosy:
+ eric.snow messages: + msg196018 |
| 2013年08月22日 14:49:46 | brett.cannon | create | |