Skip to content

Consider resurrecting the mingw_pread patches #94

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

Closed
sschuberth opened this issue Apr 15, 2015 · 10 comments
Closed

Consider resurrecting the mingw_pread patches #94

sschuberth opened this issue Apr 15, 2015 · 10 comments

Comments

@sschuberth
Copy link

Chromium uses a Windows pread performance patch since quite a while, and Stefan Zager had proposed an index-pack threading patch on top of it.

I believe it makes sense to look at integrating this again, and this issue exists so we do not forget about it.

@kblees Would you have time to look at the patch again?

@dscho
Copy link
Member

dscho commented Apr 15, 2015

According to https://msdn.microsoft.com/en-us/library/windows/desktop/aa365497%28v=vs.85%29.aspx, the ReOpenFile function is only available starting with Vista, and according to these two issues, we still have a contributor who uses XP himself...

@dscho
Copy link
Member

dscho commented Apr 15, 2015

For reference, I cherry-picked Zach's patch: master...pread

@dscho
Copy link
Member

dscho commented Apr 15, 2015

I have no physical setup right now to do proper performance tests, but we would really need to do them first. And then, if it is worth it, we can always play games with lazy-loading the ReOpenFile symbol and falling back to the malloc-based emulation.

@kblees
Copy link

kblees commented Apr 15, 2015

The NO_THREAD_SAFE_PREAD setting is gone from the Makefile, thus I suspect the problem has already been fixed upstream (e.g. by using Duy's patch [1]).

For reference, upstream discussion is at [2] (gmane seems to be lacking the concluding messages). I also provided a thread-safe mingw_pread based on ReadFile + OVERLAPPED that doesn't require Windows Vista [3].

[1] http://article.gmane.org/gmane.comp.version-control.git/196042
[2] http://git.661346.n2.nabble.com/Make-the-git-codebase-thread-safe-td7603504.html
[3] http://article.gmane.org/gmane.comp.version-control.git/242120

@kblees
Copy link

kblees commented Apr 15, 2015

...indeed: 3953949 "index-pack: work around thread-unsafe pread()" merged on 2014-03-25 (53f52cd)

@kblees kblees closed this as completed Apr 15, 2015
@dscho
Copy link
Member

dscho commented Apr 15, 2015

@kblees but we still define NO_PREAD = YesPlease, should we stop that?

@sschuberth
Copy link
Author

but we still define NO_PREAD = YesPlease, should we stop that?

I don't think we can stop that yet as there's still no mingw_pread() (neither Karsten's nor Stefan's) in our code as far as I can see. @kblees Or are you saying we do not need a mingw_pread() anymore?

For reference, I cherry-picked Zach's patch

Who's Zach? :-) Also, we probably would want to fix the indentation in that patch before merging it.

@kblees
Copy link

kblees commented Apr 15, 2015

but we still define NO_PREAD = YesPlease, should we stop that?

No, we still need NO_PREAD to get git_pread() from compat/pread.c.

We had this discussion last year because the multi-threaded index-pack algorithm required a thread-safe pread() at the time, and git_pread() is not thread-safe.

One possible solution was to provide a thread-safe mingw_pread()...until Duy proposed to change the algorithm so that it no longer requires a thread-safe implementation.

In other words: the git_pread() implentation we get with NO_PREAD is perfectly fine.

@sschuberth
Copy link
Author

And we also would not gain any performance in some other area by still providing a thread-safe mingw_pread(), correct?

@kblees
Copy link

kblees commented Apr 15, 2015

And we also would not gain any performance in some other area by still providing a thread-safe mingw_pread(), correct?

I don't think so. My version does essentially the same thing as git_pread() (just using Win32 ReadFile() instead of read()). I would think that the ReOpenFile() variant is even slower (due to the performance penalty of opening a new file handle on each call).

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

3 participants