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

simple8b: remove interfaces, use fixed buffer #3

Merged
merged 1 commit into from
Apr 21, 2016

Conversation

benbjohnson
Copy link
Contributor

Overview

This pull request changes Encoder and Decoder from interfaces to structs and changes Decoder.buf from a []uint64 to a fixed length [240]uint64. These changes were made to allow inlining of functions and to avoid slice range checks.

Benchmark

benchmark              old ns/op     new ns/op     delta
BenchmarkDecode-4      974           775           -20.43%
BenchmarkDecoder-4     6619          5679          -14.20%

benchmark              old MB/s     new MB/s     speedup
BenchmarkDecode-4      8404.84      10563.97     1.26x
BenchmarkDecoder-4     1237.58      1442.40      1.17x

This commit changes `Encoder` and `Decoder` from interfaces to
structs and changes `Decoder.buf` from a `[]uint64` to a fixed
length `[240]uint64`. These changes were made to allow inlining
of functions and to avoid slice range checks.
@jwilder jwilder merged commit b421ab4 into jwilder:master Apr 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants