]> Cypherpunks.ru repositories - gostls13.git/commit
net,internal/poll: mark it as handled even if sendfile(2) succeeded with 0 bytes...
authorAndy Pan <panjf2000@gmail.com>
Thu, 19 Oct 2023 10:50:21 +0000 (18:50 +0800)
committerGopher Robot <gobot@golang.org>
Mon, 23 Oct 2023 18:44:26 +0000 (18:44 +0000)
commitc65f74d339169a5597c64a0076c17905c85b37d8
treea2af774421f9dd244ed93afceb9789b0fdceda53
parent255ed03a94c4c91840f16fe417a7ed5097a04862
net,internal/poll: mark it as handled even if sendfile(2) succeeded with 0 bytes sent

CL 415834 fixed #53658 and somehow it only fixed it on Linux,
sendfile can also succeed with 0 bytes sent on other platforms
according to their manuals, this CL will finish the work that
CL 415834 left out on other platforms.

goos: darwin
goarch: arm64
pkg: net
                     │     old     │                new                 │
                     │   sec/op    │   sec/op     vs base               │
SendfileZeroBytes-10   7.563µ ± 5%   7.184µ ± 6%  -5.01% (p=0.009 n=10)

                     │     old     │                new                 │
                     │    B/op     │    B/op     vs base                │
SendfileZeroBytes-10   3562.5 ± 7%   590.0 ± 2%  -83.44% (p=0.000 n=10)

                     │    old    │             new              │
                     │ allocs/op │ allocs/op   vs base          │
SendfileZeroBytes-10   0.00 ± 0%   11.00 ± 0%  ? (p=0.000 n=10)

[1] https://man.freebsd.org/cgi/man.cgi?sendfile(2)
[2] https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendfile.2.html
[3] https://man.dragonflybsd.org/?command=sendfile&section=2
[4] https://docs.oracle.com/cd/E88353_01/html/E37843/sendfile-3c.html

Change-Id: I55832487595ee8e0f44f367cf2a3a1d827ba590d
Reviewed-on: https://go-review.googlesource.com/c/go/+/536455
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/internal/poll/sendfile_bsd.go
src/internal/poll/sendfile_solaris.go
src/net/sendfile_test.go
src/net/sendfile_unix_alt.go