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

Get(os.FileInfo) on Windows (7+) opens the file #1

Closed
djherbis opened this issue Jan 12, 2016 · 1 comment
Closed

Get(os.FileInfo) on Windows (7+) opens the file #1

djherbis opened this issue Jan 12, 2016 · 1 comment

Comments

@djherbis
Copy link
Owner

Get(os.FileInfo) opens the file on Win 7+ in order to obtain the ChangeTime via a file handle (which is not directly available on the Go struct). This is both expensive, and potentially problematic (my tests so far show that it doesn't seem to affect any of the file times, but I don't really want to do excessive actions behind the scenes).

I'm considering turning this off for Get and only having it active for Stat. I think this makes sense since Get should not have to Open the file, and Get should only make use of the data inside os.FileInfo.

I'm considering making this a version change as well.

Any suggestions? Complaints? Comments?

@djherbis
Copy link
Owner Author

Stat() now will open the file to get a handle and get ChangeTime.
Get() will only make use of the data already available in the FileInfo.Sys()
This means no ChangeTime from Get(), but much a faster call. [100x speedup]

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

No branches or pull requests

1 participant