pkg/chunkenc: Fix BenchmarkRead to focus on reading chunks, not converting bytes to string #1423
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously BenchmarkRead asked for every single line from chunks to be returned. This causes a lot of unnnecessary allocations (due to
string([]byte)
conversion), which dominate the benchmark. Instead of counting bytes when reading, we now count size when generating data for logging speed.Another test was added to show that these two approaches are comparable.
This change makes BenchmarkRead to report real time needed to decode chunks:
Decompression speed is now also more correct (esp. None is much higher than LZ4/Snappy)