Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaces the stdlib `compress/gzip` with `klauspost/compress/gzip`. It is slightly faster (by using less CPU) and results in the same allocs. That is assuming default gzip compression (6). Using an extraneous application to benchmark the change, I was able to observe `10-11%` more throughput (measured in events per second) and lower CPU usage. Using the same container with 2vCPU set and GOMAXPROCS=2 (200% max): - baseline: 39-40K eps - 186%-190% CPU Usage. - klauspost: 43-44.5K eps - 159% CPU usage. - `+10-11%` throughput. - `-15%` CPU usage. Microbenchmarks also point show decreased ns/op on my machine, although it's not a perfect benchmark, since it's not entirely idle, but there's improvements, even for benchmarks with a higher p. ``` $ benchstat main.txt klauspost.txt <region:us-east-1> goos: darwin goarch: arm64 pkg: github.com/elastic/go-docappender │ main.txt │ klauspost.txt │ │ sec/op │ sec/op vs base │ Appender/NoCompression-4 394.8n ± 11% 389.4n ± 17% ~ (p=0.084 n=6) Appender/NoCompressionScaling-4 353.8n ± 13% 388.2n ± 11% ~ (p=0.589 n=6) Appender/BestSpeed-4 654.5n ± 36% 572.4n ± 33% ~ (p=0.065 n=6) Appender/BestSpeedScaling-4 546.7n ± 25% 577.8n ± 30% ~ (p=0.818 n=6) Appender/DefaultCompression-4 1143.5n ± 18% 615.1n ± 43% -46.21% (p=0.002 n=6) Appender/DefaultCompressionScaling-4 997.9n ± 16% 640.7n ± 33% -35.80% (p=0.002 n=6) Appender/BestCompression-4 1.064µ ± 9% 1.098µ ± 15% ~ (p=0.965 n=6) Appender/BestCompressionScaling-4 1.056µ ± 9% 1.014µ ± 12% ~ (p=0.368 n=6) AppenderError-4 996.3n ± 1% 997.3n ± 1% ~ (p=0.937 n=6) geomean 736.6n 654.0n -11.22% ``` --------- Signed-off-by: Marc Lopez Rubio <[email protected]>
- Loading branch information