Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broadcast benchmarks #542

Merged
merged 2 commits into from Jan 2, 2022
Merged

Fix broadcast benchmarks #542

merged 2 commits into from Jan 2, 2022

Conversation

FZambia
Copy link
Contributor

@FZambia FZambia commented Sep 21, 2019

This pull request fixes broadcast benchmarks.

Before:

BenchmarkBroadcast/NoCompression-4         	     159	   7825192 ns/op	      22 B/op	       0 allocs/op
BenchmarkBroadcast/WithCompression-4       	      67	  17692579 ns/op	 1192272 B/op	   30004 allocs/op
BenchmarkBroadcast/NoCompressionPrepared-4 	     136	   9620360 ns/op	     224 B/op	       1 allocs/op
BenchmarkBroadcast/WithCompressionPrepared-4         	     139	   9190567 ns/op	    8922 B/op	       2 allocs/op

After:

BenchmarkBroadcast/NoCompression-4                   148           8806814 ns/op              43 B/op          1 allocs/op
BenchmarkBroadcast/Compression-4                      64          17525206 ns/op         1157741 B/op      30002 allocs/op
BenchmarkBroadcast/NoCompressionPrepared-4           136           9424210 ns/op           11492 B/op         17 allocs/op
BenchmarkBroadcast/CompressionPrepared-4             134           9622622 ns/op           47631 B/op         21 allocs/op

There are actually 2 fixes.

  1. Fixes wrong tests semantics. These tests must benchmark writing the same message to many connections to compare effect of using PreparedMessage in various conditions. But on every iteration of benchmark loop tests that work with PreparedMessage type must create PreparedMessage from scratch. Otherwise we see strange results almost without allocations in PreparedMessage scenarios.

  2. Fixes broken indentation in console because of very long name of test. Now benchmark results are properly aligned.

@elithrar elithrar self-assigned this Mar 19, 2020
@elithrar elithrar self-requested a review March 19, 2020 13:56
@garyburd garyburd merged commit beca1d3 into gorilla:master Jan 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants