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

fix string and bytes convert use large memory #19

Closed
wants to merge 3 commits into from

Conversation

ethan256
Copy link

jfr-parser consumes a lot of memory when processing large chunk files.

Part of the reason is that the read module has a lot of []byte and string interconversions.

@korniltsev korniltsev self-requested a review February 11, 2023 12:31
@ethan256
Copy link
Author

ethan256 commented Feb 13, 2023

@korniltsev

before benchmark:

goos: darwin
goarch: amd64
pkg: github.com/pyroscope-io/jfr-parser/parser
cpu: Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
BenchmarkParse-8   	      62	  18903331 ns/op	 6733755 B/op	  169267 allocs/op

after benchmark:

goos: darwin
goarch: amd64
pkg: github.com/pyroscope-io/jfr-parser/parser
cpu: Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
=== RUN   BenchmarkParse
BenchmarkParse
BenchmarkParse-8              63          19262599 ns/op         6552339 B/op     106477 allocs/op

@CLAassistant
Copy link

CLAassistant commented Feb 22, 2023

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@zdyj3170101136
Copy link
Contributor

you reuse the r.body, and unsafe convert it from []byte to string.

@korniltsev
Copy link
Collaborator

I will close this due to inactivity. This will be addressed by #22

@korniltsev korniltsev closed this Aug 5, 2023
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

4 participants