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

Replace cnf structhash with custom one #1298

Merged
merged 3 commits into from
Sep 4, 2019
Merged

Conversation

krhubert
Copy link
Contributor

@krhubert krhubert commented Sep 3, 2019

This version has few improvements:

  • the most important thing - it only dumps struct fields that have hash:name tag (it allows us to skip all XXX_ generated fields by protobuf)
  • cover edge cases for dump maps/interface
  • 100% test coverage
  • better performance
➜  structhash git:(feature/new-structhash) ✗ benchcmp old.out new.out
benchmark                 old ns/op     new ns/op     delta
BenchmarkSimpleJSON-6     852           894           +4.93%
BenchmarkSimpleDump-6     3806          1145          -69.92%
BenchmarkFullJSON-6       5888          6110          +3.77%
BenchmarkFullDump-6       20447         1168          -94.29%
BenchmarkTagsJSON-6       572           594           +3.85%
BenchmarkTagsDump-6       3433          4489          +30.76%

benchmark                 old allocs     new allocs     delta
BenchmarkSimpleJSON-6     1              1              +0.00%
BenchmarkSimpleDump-6     22             12             -45.45%
BenchmarkFullJSON-6       9              9              +0.00%
BenchmarkFullDump-6       130            12             -90.77%
BenchmarkTagsJSON-6       1              1              +0.00%
BenchmarkTagsDump-6       21             34             +61.90%

benchmark                 old bytes     new bytes     delta
BenchmarkSimpleJSON-6     96            96            +0.00%
BenchmarkSimpleDump-6     1056          216           -79.55%
BenchmarkFullJSON-6       960           960           +0.00%
BenchmarkFullDump-6       6336          216           -96.59%
BenchmarkTagsJSON-6       48            48            +0.00%
BenchmarkTagsDump-6       680           960           +41.18%

@krhubert krhubert added this to the next milestone Sep 3, 2019
@krhubert krhubert self-assigned this Sep 3, 2019
@krhubert krhubert force-pushed the feature/new-structhash branch 2 times, most recently from 5ade315 to 3ea62a7 Compare September 3, 2019 13:54
@krhubert krhubert merged commit 3c631e8 into dev Sep 4, 2019
@krhubert krhubert deleted the feature/new-structhash branch September 4, 2019 06:18
@NicolasMahe NicolasMahe added the release:change Pull requests that change something existant label Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring release:change Pull requests that change something existant
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants