Repository navigation
bpo-33671: efficient zero-copy for shutil.copy* functions (Linux, OSX and Win) #7160
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
Changes from 1 commit
1a72c01
77c4bfa
2afa04a
542cd17
3520c6c
050a722
c1fd38a
2ab6317
dacc3b6
29d5881
114c4de
501c0dd
41b4506
fdb0973
64d2bc5
3a3c8ef
7861737
f3eecfd
f67ce57
d457254
8eb211d
a0fe703
7296147
d0c3bba
2cafd80
bb2a75f
e5025dc
a36a534
e9da3fa
9fcc2e7
4f32242
24ad25a
24d20e6
7b6e576
b82ddc9
b62b61e
34e9618
6b20902
abf3ecb
91e492c
e02c69d
73837e2
28be4c1
6c59adf
700629d
077912e
62c6568
a40a755
7ba0085
6c96d97
80fbe6e
fdf4bcb
185f130
c8c98ae
17bb5e6
d8b9bf9
b59ac57
8eefce7
4fc8c6b
3048e3d
11102e1
7545273
3261b74
51c476d
729dd23
1823828
a9d6a07
e3ce917
f81a0ec
3e7475b
05dd3cf
9b54930
2bec11c
c87648f
941f740
4d28c12
2149b8b
6a02a2a
2287508
b9da5d5
c921f46
bb24490
fef8b32
71be453
6035fe2
8dc651e
5d0eada
d67cdc5
f65c8ae
9c4508e
bb1fee6
566898a
f435053
30c9a57
33f362f
e17e729
bc46f75
cabbc02
d22ee08
7a08203
ab284e9
ac9479d
fd77a7e
42a597e
5008a8d
e89dd20
c0dc4b8
29b9730
a1bed32
d9d27a7
17bd78b
b1d4917
5ce94e4
07bcef5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,10 +129,11 @@ def copyfileobj(fsrc, fdst, length=COPY_BUFSIZE): | |
| def _copyfileobj2(fsrc, fdst): | ||
| """Same as above but tries to use zero-copy sendfile(2) syscall | ||
| (faster). This is used by copyfile(), copy() and copy2() in order | ||
| to leave copyfileobj() alone and not introduce backward | ||
| incompatibilities. | ||
| to leave copyfileobj() alone and not introduce any backward | ||
| incompatibility. | ||
| E.g. by using sendfile() fdst cannot be opened in "a"(ppend) mode | ||
| and its offset doesn't get updated. | ||
| and its offset doesn't get updated. Also, fsrc and fdst may be | ||
| opened in text mode. | ||
| """ | ||
| if _HAS_SENDFILE: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given a configure check for The dynamic check to handle the case where a Python built on a newer distro is run against an older kernel (and hence still gets
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See my comment above. |
||
| try: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest
_copyfileobj_fastas the name for this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
_zerocopy_fileobjin order to remain consistent with_zerocopy_osx,_zerocopy_winand_zerocopy_sendfile?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given @eryksun's comments, a more technically accurate set of names might be
_fastcopy_osx,_fastcopy_win,_fastcopy_sendfile,_fastcopy_fileobj, and_GiveUpOnFastCopy.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done.