diff --git a/README.md b/README.md index 6ec664e..761d0ff 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,11 @@ func main() { } ``` +## Benchmark + +See the [benchmark results](results.md) to get an idea of the relative performance and +compression efficiency of gzip, brotli and zstd in the current implementation. + ## TODO - Add dictionary support to gzip and brotli (zstd already supports it) diff --git a/results.md b/results.md new file mode 100644 index 0000000..efec371 --- /dev/null +++ b/results.md @@ -0,0 +1,176 @@ +Results of running +``` +go test -count=5 -bench=././././serial | benchstat -html > results.md +``` + +The benchmark names follow the format `Adapter/(body_size)/(encoder)/(level)/serial-*`. + +The first table lists time to compress the body with the specified encoder and level. + +The second table lists the size of the resulting compressed body. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
nametime/op
Adapter/10/gzip/1/serial-12924ns ± 0%
Adapter/10/br/1/serial-12933ns ± 5%
Adapter/10/zstd/1/serial-12968ns ± 5%
Adapter/100/gzip/1/serial-12960ns ± 6%
Adapter/100/br/1/serial-12963ns ± 6%
Adapter/100/zstd/1/serial-12975ns ± 6%
Adapter/1000/gzip/1/serial-1230.8µs ±10%
Adapter/1000/gzip/2/serial-1285.9µs ± 5%
Adapter/1000/gzip/3/serial-1285.6µs ± 0%
Adapter/1000/gzip/4/serial-1289.2µs ± 5%
Adapter/1000/gzip/5/serial-1289.3µs ± 0%
Adapter/1000/gzip/6/serial-1291.4µs ± 2%
Adapter/1000/gzip/7/serial-1293.1µs ± 6%
Adapter/1000/gzip/8/serial-1293.4µs ± 6%
Adapter/1000/gzip/9/serial-1293.5µs ± 8%
Adapter/1000/br/1/serial-1227.7µs ± 1%
Adapter/1000/br/2/serial-1242.6µs ±10%
Adapter/1000/br/3/serial-1269.9µs ± 4%
Adapter/1000/br/4/serial-1299.4µs ±12%
Adapter/1000/br/5/serial-12111µs ± 7%
Adapter/1000/br/6/serial-12112µs ± 4%
Adapter/1000/br/7/serial-12141µs ± 4%
Adapter/1000/br/8/serial-12147µs ±19%
Adapter/1000/br/9/serial-12154µs ± 1%
Adapter/1000/br/10/serial-122.44ms ± 5%
Adapter/1000/br/11/serial-124.09ms ± 1%
Adapter/1000/zstd/1/serial-1218.1µs ±10%
Adapter/1000/zstd/2/serial-1221.6µs ± 7%
Adapter/1000/zstd/3/serial-1231.2µs ±14%
Adapter/1000/zstd/4/serial-1279.9µs ±14%
Adapter/10000/gzip/1/serial-12134µs ±19%
Adapter/10000/gzip/2/serial-12201µs ± 3%
Adapter/10000/gzip/3/serial-12203µs ± 1%
Adapter/10000/gzip/4/serial-12247µs ±19%
Adapter/10000/gzip/5/serial-12246µs ± 1%
Adapter/10000/gzip/6/serial-12269µs ± 7%
Adapter/10000/gzip/7/serial-12335µs ± 3%
Adapter/10000/gzip/8/serial-12371µs ± 0%
Adapter/10000/gzip/9/serial-12381µs ±11%
Adapter/10000/br/1/serial-12148µs ± 2%
Adapter/10000/br/2/serial-12325µs ±10%
Adapter/10000/br/3/serial-12389µs ± 0%
Adapter/10000/br/4/serial-12557µs ±19%
Adapter/10000/br/5/serial-12614µs ± 2%
Adapter/10000/br/6/serial-12655µs ± 8%
Adapter/10000/br/7/serial-12804µs ± 4%
Adapter/10000/br/8/serial-12823µs ± 7%
Adapter/10000/br/9/serial-12978µs ± 5%
Adapter/10000/br/10/serial-1210.9ms ± 8%
Adapter/10000/br/11/serial-1229.5ms ±14%
Adapter/10000/zstd/1/serial-1274.6µs ±16%
Adapter/10000/zstd/2/serial-12124µs ± 8%
Adapter/10000/zstd/3/serial-12200µs ± 7%
Adapter/10000/zstd/4/serial-12634µs ± 8%
Adapter/100000/gzip/1/serial-121.12ms ± 9%
Adapter/100000/gzip/2/serial-121.35ms ± 1%
Adapter/100000/gzip/3/serial-121.53ms ± 5%
Adapter/100000/gzip/4/serial-121.73ms ± 6%
Adapter/100000/gzip/5/serial-121.99ms ± 1%
Adapter/100000/gzip/6/serial-122.34ms ± 7%
Adapter/100000/gzip/7/serial-123.80ms ±12%
Adapter/100000/gzip/8/serial-128.67ms ± 3%
Adapter/100000/gzip/9/serial-128.96ms ±12%
Adapter/100000/br/1/serial-121.48ms ±13%
Adapter/100000/br/2/serial-123.01ms ± 5%
Adapter/100000/br/3/serial-123.51ms ± 2%
Adapter/100000/br/4/serial-124.58ms ± 7%
Adapter/100000/br/5/serial-125.51ms ± 0%
Adapter/100000/br/6/serial-126.04ms ± 4%
Adapter/100000/br/7/serial-127.11ms ± 0%
Adapter/100000/br/8/serial-127.86ms ± 3%
Adapter/100000/br/9/serial-1210.2ms ± 5%
Adapter/100000/br/10/serial-12113ms ±10%
Adapter/100000/br/11/serial-12312ms ± 2%
Adapter/100000/zstd/1/serial-12629µs ± 1%
Adapter/100000/zstd/2/serial-12859µs ± 4%
Adapter/100000/zstd/3/serial-121.02ms ± 2%
Adapter/100000/zstd/4/serial-123.79ms ±11%
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
name%
Adapter/10/gzip/1/serial-12100 ± 0%
Adapter/10/br/1/serial-12100 ± 0%
Adapter/10/zstd/1/serial-12100 ± 0%
Adapter/100/gzip/1/serial-12100 ± 0%
Adapter/100/br/1/serial-12100 ± 0%
Adapter/100/zstd/1/serial-12100 ± 0%
Adapter/1000/gzip/1/serial-1244.2 ± 0%
Adapter/1000/gzip/2/serial-1241.9 ± 0%
Adapter/1000/gzip/3/serial-1241.7 ± 0%
Adapter/1000/gzip/4/serial-1241.7 ± 0%
Adapter/1000/gzip/5/serial-1241.1 ± 0%
Adapter/1000/gzip/6/serial-1241.1 ± 0%
Adapter/1000/gzip/7/serial-1241.0 ± 0%
Adapter/1000/gzip/8/serial-1241.0 ± 0%
Adapter/1000/gzip/9/serial-1241.0 ± 0%
Adapter/1000/br/1/serial-1245.2 ± 0%
Adapter/1000/br/2/serial-1242.1 ± 0%
Adapter/1000/br/3/serial-1239.9 ± 0%
Adapter/1000/br/4/serial-1239.3 ± 0%
Adapter/1000/br/5/serial-1236.6 ± 0%
Adapter/1000/br/6/serial-1236.8 ± 0%
Adapter/1000/br/7/serial-1236.7 ± 0%
Adapter/1000/br/8/serial-1236.7 ± 0%
Adapter/1000/br/9/serial-1236.7 ± 0%
Adapter/1000/br/10/serial-1237.4 ± 0%
Adapter/1000/br/11/serial-1237.2 ± 0%
Adapter/1000/zstd/1/serial-1243.1 ± 0%
Adapter/1000/zstd/2/serial-1242.2 ± 0%
Adapter/1000/zstd/3/serial-1241.7 ± 0%
Adapter/1000/zstd/4/serial-1241.3 ± 0%
Adapter/10000/gzip/1/serial-1229.6 ± 0%
Adapter/10000/gzip/2/serial-1228.5 ± 0%
Adapter/10000/gzip/3/serial-1228.1 ± 0%
Adapter/10000/gzip/4/serial-1228.2 ± 0%
Adapter/10000/gzip/5/serial-1227.7 ± 0%
Adapter/10000/gzip/6/serial-1227.6 ± 0%
Adapter/10000/gzip/7/serial-1227.2 ± 0%
Adapter/10000/gzip/8/serial-1227.2 ± 0%
Adapter/10000/gzip/9/serial-1227.2 ± 0%
Adapter/10000/br/1/serial-1229.9 ± 0%
Adapter/10000/br/2/serial-1228.1 ± 0%
Adapter/10000/br/3/serial-1227.9 ± 0%
Adapter/10000/br/4/serial-1227.5 ± 0%
Adapter/10000/br/5/serial-1226.0 ± 0%
Adapter/10000/br/6/serial-1225.9 ± 0%
Adapter/10000/br/7/serial-1225.8 ± 0%
Adapter/10000/br/8/serial-1225.8 ± 0%
Adapter/10000/br/9/serial-1225.8 ± 0%
Adapter/10000/br/10/serial-1223.4 ± 0%
Adapter/10000/br/11/serial-1223.1 ± 0%
Adapter/10000/zstd/1/serial-1228.6 ± 0%
Adapter/10000/zstd/2/serial-1228.1 ± 0%
Adapter/10000/zstd/3/serial-1228.0 ± 0%
Adapter/10000/zstd/4/serial-1227.6 ± 0%
Adapter/100000/gzip/1/serial-1227.3 ± 0%
Adapter/100000/gzip/2/serial-1226.2 ± 0%
Adapter/100000/gzip/3/serial-1225.7 ± 0%
Adapter/100000/gzip/4/serial-1225.8 ± 0%
Adapter/100000/gzip/5/serial-1225.0 ± 0%
Adapter/100000/gzip/6/serial-1224.8 ± 0%
Adapter/100000/gzip/7/serial-1224.2 ± 0%
Adapter/100000/gzip/8/serial-1224.1 ± 0%
Adapter/100000/gzip/9/serial-1224.1 ± 0%
Adapter/100000/br/1/serial-1227.6 ± 0%
Adapter/100000/br/2/serial-1225.4 ± 0%
Adapter/100000/br/3/serial-1225.3 ± 0%
Adapter/100000/br/4/serial-1224.9 ± 0%
Adapter/100000/br/5/serial-1223.6 ± 0%
Adapter/100000/br/6/serial-1223.4 ± 0%
Adapter/100000/br/7/serial-1223.3 ± 0%
Adapter/100000/br/8/serial-1223.2 ± 0%
Adapter/100000/br/9/serial-1223.2 ± 0%
Adapter/100000/br/10/serial-1220.2 ± 0%
Adapter/100000/br/11/serial-1219.9 ± 0%
Adapter/100000/zstd/1/serial-1225.9 ± 0%
Adapter/100000/zstd/2/serial-1225.7 ± 0%
Adapter/100000/zstd/3/serial-1225.6 ± 0%
Adapter/100000/zstd/4/serial-1225.3 ± 0%