Skip to content

replace collectException(dirEntry()) idiom - #64

Merged
andralex merged 1 commit into
dlang:masterfrom
MartinNowak:useExists
Jun 18, 2013
Merged

andralex merged 1 commit into
dlang:masterfrom
MartinNowak:useExists

Conversation

@MartinNowak

Copy link
Copy Markdown
Member
  • it used exceptions to handle non-exceptional
    situations only to avoid a stat call

NB:
The fact that it can't be done in an optimal way is really an API issue of std.file.dirEntry.

- it used exceptions to handle non-exceptional
  situations only to avoid a stat call
@MartinNowak

Copy link
Copy Markdown
Member Author

Issue 10240

andralex added a commit that referenced this pull request Jun 18, 2013
replace collectException(dirEntry()) idiom
@andralex
andralex merged commit cbe7e38 into dlang:master Jun 18, 2013
@andralex

Copy link
Copy Markdown
Member

We must undo this. I've done extensive measurements and stat() calls are REALLY expensive at least on Unixen. Essentially minimizing stat calls in large systems is a sure path to optimization. I am sorry I've pulled this.

@MartinNowak

Copy link
Copy Markdown
Member Author

In fact this didn't change the number of stat calls (2 per isDir check) because the constructor of DirEntry performs a stat call to enforce that the path exists (https://github.com/D-Programming-Language/phobos/blob/master/std/file.d#L1989) only to do another stat call to find out if it's a directory.
We need to fix Issue 10240.

@andralex

Copy link
Copy Markdown
Member

yah I saw that bug in DirEntry - what a drag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants