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

Hardcode integer sizes #427

Merged
merged 1 commit into from
Apr 16, 2015
Merged

Hardcode integer sizes #427

merged 1 commit into from
Apr 16, 2015

Conversation

eapache
Copy link
Contributor

@eapache eapache commented Apr 16, 2015

My recent playing with benchmarks led me down the slippery slop into profiling,
where I found this oddity. Calling binary.Size() actually involves reflection
on the argument which is expensive (of course). There was really no reason not
to hardcode these other than vague hand-waving towards portability (really).

Saves us about 2.5% of profiled time in the producer benchmarks.

@Shopify/kafka

My recent playing with benchmarks led me down the slippery slop into profiling,
where I found this oddity. Calling `binary.Size()` actually involves reflection
on the argument which is expensive (of course). There was really no reason not
to hardcode these other than vague hand-waving towards portability (really).

Saves us about 2.5% of profiled time in the producer benchmarks.
@wvanbergen
Copy link
Contributor

nice find! :shipit:

@eapache
Copy link
Contributor Author

eapache commented Apr 16, 2015

slight tangent: crc32 calculations account for nearly 40% of the time, so #255 is real and is the lowest-hanging fruit if we ever desperately need more performance.

eapache added a commit that referenced this pull request Apr 16, 2015
@eapache eapache merged commit 115289d into master Apr 16, 2015
@eapache eapache deleted the hardcode-binary-size branch April 16, 2015 20:09
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