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

Don't use string builder in subjString (it is slow) #3956

Merged
merged 1 commit into from Mar 13, 2023

Conversation

neilalexander
Copy link
Member

We were already converting key to a string in the loop, so the use of a strings.Builder is additionally wasteful and burns CPU cycles for no reason. Let's just convert key once instead — when it becomes a string, it already stops referring to the underlying array anyway.

Signed-off-by: Neil Twigg neil@nats.io

@neilalexander neilalexander marked this pull request as ready for review March 13, 2023 12:10
@neilalexander neilalexander requested a review from a team as a code owner March 13, 2023 12:10
Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

LGTM!

@neilalexander neilalexander merged commit 07bc964 into main Mar 13, 2023
@neilalexander neilalexander deleted the neil/subjstring branch March 13, 2023 12:52
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