Re: [Python-Dev] possibility of shaving a stat call from imports

2013-10-18 Thread Nick Coghlan
On 19 Oct 2013 02:56, "Brett Cannon" wrote: > > importlib.machinery.FileFinder does a stat call to check if a path is a file if the package check failed. Now I'm willing to bet that the check is rather redundant as the file extension should be a dead give-away that something in a directory is a fi

Re: [Python-Dev] possibility of shaving a stat call from imports

2013-10-18 Thread Eric Snow
On Fri, Oct 18, 2013 at 2:59 PM, Antoine Pitrou wrote: > Is it one stat() call per successful import? Or one stat() call per > sys.path entry? It's one per finder (i.e. path entry) where a matching name is in the directory (per the finder's cache). So it's a pretty uncommon case with not much ov

Re: [Python-Dev] possibility of shaving a stat call from imports

2013-10-18 Thread Tim Delaney
On 19 October 2013 03:53, Brett Cannon wrote: > importlib.machinery.FileFinder does a stat call to check if a path is a > file if the package check failed. Now I'm willing to bet that the check is > rather redundant as the file extension should be a dead give-away that > something in a directory

Re: [Python-Dev] possibility of shaving a stat call from imports

2013-10-18 Thread Antoine Pitrou
On Fri, 18 Oct 2013 12:53:55 -0400 Brett Cannon wrote: > importlib.machinery.FileFinder does a stat call to check if a path is a > file if the package check failed. Now I'm willing to bet that the check is > rather redundant as the file extension should be a dead give-away that > something in a di