Skip to content

Conversation

kevinGC
Copy link
Contributor

@kevinGC kevinGC commented Oct 8, 2025

This has been useful to me for quick testing to see whether changes are performant. Compared to other benchmarks in record_test, this:

  • Exercises TCP, which is more realistic than byte.Buffer
  • Runs the reader and writer in parallel rather than sequentually

Since it only runs locally, it can be run easily. For example:

$ go test -run="^$" -bench="BenchmarkTCP" ./credentials/alts/internal/conn
goos: linux
goarch: amd64
pkg: google.golang.org/grpc/credentials/alts/internal/conn
cpu: AMD Ryzen Threadripper PRO 3945WX 12-Cores
BenchmarkTCP/size=1_KiB-12                   100          10058898 ns/op                 0 Mbps         97.34 cpu-usec/op               97.34 sys-usec/op                0 usr-usec/op
BenchmarkTCP/size=4_KiB-12                   100          10069605 ns/op                 2.979 Mbps            146.2 cpu-usec/op               104.7 sys-usec/op                41.42 usr-usec/op
BenchmarkTCP/size=64_KiB-12                  100          10510067 ns/op                47.57 Mbps            1116 cpu-usec/op         859.7 sys-usec/op               256.7 usr-usec/op
BenchmarkTCP/size=512_KiB-12                 100          13707500 ns/op               291.8 Mbps             8167 cpu-usec/op        6872 sys-usec/op        1295 usr-usec/op
BenchmarkTCP/size=1_MiB-12                   100          17343824 ns/op               461.3 Mbps            16276 cpu-usec/op       13361 sys-usec/op        2915 usr-usec/op
BenchmarkTCP/size=4_MiB-12                    32          39019702 ns/op               820.1 Mbps            64387 cpu-usec/op       51945 sys-usec/op       12443 usr-usec/op
PASS
ok      google.golang.org/grpc/credentials/alts/internal/conn   7.487s

This has been useful to me for quick testing to see whether changes are
performant. Compared to other benchmarks in record_test, this:

- Exercises TCP, which is more realistic than byte.Buffer
- Runs the reader and writer in parallel rather than sequentually

Since it only runs locally, it can be run easily. For example:

```
$ go test -run="^$" -bench="BenchmarkTCP" ./credentials/alts/internal/conn
goos: linux
goarch: amd64
pkg: google.golang.org/grpc/credentials/alts/internal/conn
cpu: AMD Ryzen Threadripper PRO 3945WX 12-Cores
BenchmarkTCP/size=1_KiB-12                   100          10058898 ns/op                 0 Mbps         97.34 cpu-usec/op               97.34 sys-usec/op                0 usr-usec/op
BenchmarkTCP/size=4_KiB-12                   100          10069605 ns/op                 2.979 Mbps            146.2 cpu-usec/op               104.7 sys-usec/op                41.42 usr-usec/op
BenchmarkTCP/size=64_KiB-12                  100          10510067 ns/op                47.57 Mbps            1116 cpu-usec/op         859.7 sys-usec/op               256.7 usr-usec/op
BenchmarkTCP/size=512_KiB-12                 100          13707500 ns/op               291.8 Mbps             8167 cpu-usec/op        6872 sys-usec/op        1295 usr-usec/op
BenchmarkTCP/size=1_MiB-12                   100          17343824 ns/op               461.3 Mbps            16276 cpu-usec/op       13361 sys-usec/op        2915 usr-usec/op
BenchmarkTCP/size=4_MiB-12                    32          39019702 ns/op               820.1 Mbps            64387 cpu-usec/op       51945 sys-usec/op       12443 usr-usec/op
PASS
ok      google.golang.org/grpc/credentials/alts/internal/conn   7.487s
```
Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.00%. Comparing base (9ff80a7) to head (ef52555).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8636      +/-   ##
==========================================
+ Coverage   81.96%   82.00%   +0.04%     
==========================================
  Files         415      415              
  Lines       40694    40694              
==========================================
+ Hits        33355    33372      +17     
- Misses       5950     5962      +12     
+ Partials     1389     1360      -29     

see 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Successfully merging this pull request may close these issues.

1 participant