Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace collectException(dirEntry()) idiom #64

Merged
merged 1 commit into from
Jun 18, 2013

Conversation

MartinNowak
Copy link
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
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
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
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
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