]> Cypherpunks repositories - gostls13.git/commit
net: support benchmark testing for sendfile on various platforms
authorAndy Pan <panjf2000@gmail.com>
Sat, 18 Nov 2023 10:59:51 +0000 (18:59 +0800)
committerGopher Robot <gobot@golang.org>
Wed, 7 Feb 2024 20:33:40 +0000 (20:33 +0000)
commite55bf08d98b163e6f94d164fc650d2e427bc9c3b
tree2bb33b67bec076349a2fc5c8c1b5b8928dbf75f6
parent6abeffb18ea263b14cbe5936e8bdbbf08546e4b8
net: support benchmark testing for sendfile on various platforms

When I introduced the benchmark test code for sendfile(2) in CL 425878,
I only did it on Linux while the sendfile system call is also available
on other Unix-like and Windows platforms, this CL will pick up where I left out.

goos: darwin
goarch: arm64
pkg: net
BenchmarkSendFile/file-to-tcp/1024-10      2240488        749.5 ns/op 1366.30 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/2048-10      1956669        850.4 ns/op 2408.38 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/4096-10       840103       1593 ns/op 2571.30 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/8192-10       449536       2881 ns/op 2843.35 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/16384-10      269974       6307 ns/op 2597.86 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/32768-10      137210      12646 ns/op 2591.09 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/65536-10       66642      24557 ns/op 2668.74 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/131072-10      37852      59550 ns/op 2201.03 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/262144-10      16288     107859 ns/op 2430.44 MB/s        2 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/524288-10      10540     249957 ns/op 2097.52 MB/s        3 B/op        0 allocs/op
BenchmarkSendFile/file-to-tcp/1048576-10      4982     419750 ns/op 2498.09 MB/s        6 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/1024-10     1180185       1187 ns/op  862.66 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/2048-10      523159       2294 ns/op  892.78 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/4096-10      238792       5223 ns/op  784.29 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/8192-10      116611      10929 ns/op  749.58 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/16384-10      57568      19870 ns/op  824.57 MB/s        0 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/32768-10      32280      33696 ns/op  972.47 MB/s        1 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/65536-10      17242      72122 ns/op  908.69 MB/s        1 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/131072-10      8350     159131 ns/op  823.67 MB/s        3 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/262144-10      3872     318000 ns/op  824.35 MB/s        8 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/524288-10      1766     600785 ns/op  872.67 MB/s       18 B/op        0 allocs/op
BenchmarkSendFile/file-to-unix/1048576-10            993    1138624 ns/op  920.92 MB/s       33 B/op        0 allocs/op

goos: linux
goarch: amd64
pkg: net
cpu: DO-Premium-AMD
BenchmarkSendFile/file-to-tcp/1024-8             1796002               716.3 ns/op      1429.59 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/2048-8             1196700               896.6 ns/op      2284.23 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/4096-8              923604              2385 ns/op        1717.48 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/8192-8              638967              9722 ns/op         842.60 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/16384-8             357740             18710 ns/op         875.67 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/32768-8             147417             17489 ns/op        1873.66 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/65536-8             113054             58818 ns/op        1114.21 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/131072-8             57981            113202 ns/op        1157.86 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/262144-8             26362            253376 ns/op        1034.61 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/524288-8             13767            442053 ns/op        1186.03 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-tcp/1048576-8             4906            829984 ns/op        1263.37 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/1024-8            2031691               628.9 ns/op      1628.36 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/2048-8            1294472               965.0 ns/op      2122.30 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/4096-8            1005753              1203 ns/op        3404.27 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/8192-8             865448              6412 ns/op        1277.65 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/16384-8            268946             12801 ns/op        1279.89 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/32768-8            153398              6691 ns/op        4897.23 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/65536-8             88911             11969 ns/op        5475.36 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/131072-8            48639            107538 ns/op        1218.84 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/262144-8            22720            203199 ns/op        1290.09 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/524288-8            12034             97126 ns/op        5398.03 MB/s           0 B/op          0 allocs/op
BenchmarkSendFile/file-to-unix/1048576-8            5374            202308 ns/op        5183.06 MB/s           0 B/op          0 allocs/op

Change-Id: Ib9507bd9837ecb38b1702afa89502da18806929c
Reviewed-on: https://go-review.googlesource.com/c/go/+/543276
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/net/mockserver_test.go
src/net/sendfile_linux_test.go [deleted file]
src/net/sendfile_test.go
src/net/splice_linux_test.go