Skip to content

Instantly share code, notes, and snippets.

@kjk
Created December 11, 2014 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjk/cad272b2b24084c6227c to your computer and use it in GitHub Desktop.
Save kjk/cad272b2b24084c6227c to your computer and use it in GitHub Desktop.
Improving smaz benchmarking

Before:

Krzysztofs-MacBook-Pro-4:go-smaz kkowalczyk$ go test -bench=.
PASS
BenchmarkCompression	     500	   3451735 ns/op	  39.60 MB/s
BenchmarkDecompression	     500	   2740847 ns/op	  27.58 MB/s

After:

Krzysztofs-MacBook-Pro-4:go-smaz kkowalczyk$ go test -bench=.
PASS
BenchmarkCompression	     500	   3327594 ns/op	  41.08 MB/s
BenchmarkDecompression	    1000	   1254536 ns/op	  60.26 MB/s

Change:

Krzysztofs-MacBook-Pro-4:go-smaz kkowalczyk$ benchcmp before1.txt after1.txt
benchmark                  old ns/op     new ns/op     delta
BenchmarkCompression       3358002       3327181       -0.92%
BenchmarkDecompression     2560761       1270746       -50.38%

benchmark                  old MB/s     new MB/s     speedup
BenchmarkCompression       40.70        41.08        1.01x
BenchmarkDecompression     29.52        59.49        2.02x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment