Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

optimize encoder for common types #18

Merged
merged 4 commits into from Jun 12, 2017

Conversation

achille-roussel
Copy link
Contributor

This leads a small throughput increase on the encoder benchmark and enables a memory optimization on the application side:

benchmark                  old ns/op     new ns/op     delta
BenchmarkCodeEncoder-4     12958944      12751068      -1.60%

benchmark                  old MB/s     new MB/s     speedup
BenchmarkCodeEncoder-4     149.74       152.18       1.02x

benchmark                  old allocs     new allocs     delta
BenchmarkCodeEncoder-4     0              0              +0.00%

benchmark                  old bytes     new bytes     delta
BenchmarkCodeEncoder-4     0             0             +0.00%

Achille Roussel added 2 commits June 9, 2017 21:51

// EncodeBool uses e to encode the boolean value v.
func (e Encoder) EncodeBool(v bool) (err error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change? If so, should we leave them in for compatibility and add a deprecation note?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, these methods were here for optimization purposes but the new form is more generic. I know that we have no software that depended on those methods, there may be something out there that could be depended on it, in that case they'll need to adapt their code.

I'll add something to the readme explaining that change that needs to be made, but I don't think a deprecation period would be overkill for this case.

@achille-roussel
Copy link
Contributor Author

@f2prateek are you satisfied with the README update?

@f2prateek
Copy link

@achille-roussel yep!

@achille-roussel
Copy link
Contributor Author

Thanks for the review!

@achille-roussel achille-roussel merged commit 3b9d94f into master Jun 12, 2017
@achille-roussel achille-roussel deleted the optimize-encoding-common-types branch June 12, 2017 18:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants