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

Improve message building speed by using less fmt.Sprintf #32

Merged
merged 1 commit into from
May 9, 2017

Conversation

corsc
Copy link
Contributor

@corsc corsc commented May 4, 2017

Resubmission of PR23

The results of running the benchmark

BenchmarkFormatV1-8   	10000000	      3057 ns/op
BenchmarkFormatV2-8   	20000000	      1769 ns/op
BenchmarkFormatV3-8   	20000000	      1392 ns/op

@corsc
Copy link
Contributor Author

corsc commented May 4, 2017

Sorry, I tried to get fancy with git and not create a commit while rebasing and completely failed.

I am not sure if it should a separate ticket or not but go test -v github.com/DataDog/datadog-go/statsd -run ^TestSendMsg$ does not work for me. On my branch or the current master

Copy link
Member

@truthbk truthbk left a comment

Choose a reason for hiding this comment

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

@corsc brilliant stuff, thank you for this improvement, not just in performance, but code quality and readability in general. Thanks!

@truthbk
Copy link
Member

truthbk commented May 8, 2017

@corsc I think we can create a separate ticket for the failing test (go test -v github.com/DataDog/datadog-go/statsd -run ^TestSendMsg$), particularly since it's broken on master already.

@truthbk truthbk added this to the 1.2.0 milestone May 8, 2017
@truthbk truthbk merged commit 4bf1c11 into DataDog:master May 9, 2017
arbll added a commit that referenced this pull request Jun 14, 2019
…ement)

setting the precision to 6 appears to be much more expensive even when
formating floats with more than 6 digits after the decimal point

using 6 digits was introduced here #32
most other open source projects seems to use -1

the only exception is timing which will often have a high number of digits after the decimal
point. let's keep it at 6 for it
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.

None yet

2 participants