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

Use fmt.Fprintf instead of fmt.Sprintf #8922

Merged
merged 1 commit into from Oct 4, 2021

Conversation

tdakkota
Copy link
Contributor

@tdakkota tdakkota commented Oct 4, 2021

Description

This PR replaces fmt.Sprintf calls with fmt.Fprintf and friends
where it is possible.

The w.Write([]byte(fmt.Sprintf(...))) pattern is quite inefficient, it allocates
3x more than fmt.Fprintf.

I see that this PR changes only some debug and observability-related code. Anyway, I hope it will be helpful.

This commit replaces fmt.Sprintf calls with fmt.Fprintf and friends
where it is possible.

The w.Write([]byte(fmt.Sprintf(...))) pattern is quite inefficient, it allocates
3x more than fmt.Fprintf variant.

Signed-off-by: tdakkota <tanc13@yandex.ru>
Copy link
Contributor

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@systay systay left a comment

Choose a reason for hiding this comment

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

Nice stuff

@deepthi deepthi merged commit c1e0184 into vitessio:main Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants