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

perf: improve memory and cpu performance of rest collector #3310

Merged
merged 1 commit into from
Nov 20, 2024
Merged

Conversation

cgrinds
Copy link
Collaborator

@cgrinds cgrinds commented Nov 20, 2024

Using the gjson String() method will often cause the entire JSON string to be retained in memory.

This PR copies gjson to the thirdparty package and adds a ClonedString method to gjson.Result. The ClonedString method returns a cloned copy of the Result string so that the larger JSON string is available for garbage collection.

The Rest and RestPerf collectors were updated to use gjson.ClonedString().

A similar fix was made in #2054 for RestPerf.

Using the gjson `String()` method will often cause the entire JSON string to be retained in memory.

This PR copies gjson to the thirdparty package and adds a `ClonedString` method to `gjson.Result`. The `ClonedString` method returns a cloned copy of the Result string so that the larger JSON string is available for garbage collection.

The Rest and RestPerf collectors were updated to use `gjson.ClonedString()`.

A similar fix was made in #2054 for RestPerf.
@cla-bot cla-bot bot added the cla-signed label Nov 20, 2024
@cgrinds cgrinds merged commit 73d63fd into main Nov 20, 2024
8 checks passed
@cgrinds cgrinds deleted the cbg-mem branch November 20, 2024 19:10
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.

1 participant