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

Encoding speedups for strings and bools #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

crast
Copy link
Contributor

@crast crast commented Jun 4, 2016

Some speedups on string and boolean encoding primarily by reducing the amount of allocations required, thus reducing gc garbage as well. The string encoding speedup was pretty significant, because it saves an extra copy of the whole string, so the longer the string the better the speedup, but even on short strings you get 21.66% speedup.

String results:

$ benchcmp a.txt b.txt 
benchmark                              old ns/op     new ns/op     delta
BenchmarkStringSerialization_small     157           123           -21.66%
BenchmarkStringSerialization_med       181           126           -30.39%
BenchmarkStringSerialization_large     730           186           -74.52%

Boolean results:

$ benchcmp a.txt b.txt 
benchmark                           old ns/op     new ns/op     delta
BenchmarkBooleanSerialization-4     36.3          21.8          -39.94%

* 20%-75%+ speedup on string encoding and reduce GC garbage
* About a 40% speedup on bool encoding and reduce GC garbage
@crast
Copy link
Contributor Author

crast commented Aug 4, 2016

ping

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.

1 participant