Skip to content

fix(pprof parsing): decrease number of allocations during stack hash #1822

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

Merged
merged 1 commit into from
Jan 30, 2023

Conversation

korniltsev
Copy link
Collaborator

There was an attempt to do the whole hashing on the stack

	var hashes [64 + 32]uint64
	s := hashes[:]

unfortunately it should have been

	s := hashes[:0]

also

with this code

	sh.Data = uintptr(unsafe.Pointer(&s[0]))

hashes escapes to heap
and with this does not escape

ps := uintptr(unsafe.Pointer(&s[0]))
sh.Data = ps

which is weird

I rewrote to just hash on a single preallocated heap/arena slice

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
webapp/public/assets/app.js 1006.8 KB (0%) 20.2 s (0%) 3.7 s (-4.34% 🔽) 23.9 s
webapp/public/assets/app.css 19.88 KB (0%) 398 ms (0%) 0 ms (+100% 🔺) 398 ms
webapp/public/assets/styles.css 9.6 KB (0%) 192 ms (0%) 0 ms (+100% 🔺) 192 ms
packages/pyroscope-flamegraph/dist/index.js 632.75 KB (0%) 12.7 s (0%) 1.7 s (-13.31% 🔽) 14.3 s
packages/pyroscope-flamegraph/dist/index.node.js 633.45 KB (0%) 12.7 s (0%) 749 ms (-12.32% 🔽) 13.5 s
packages/pyroscope-flamegraph/dist/index.css 8.11 KB (0%) 163 ms (0%) 0 ms (+100% 🔺) 163 ms

@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

Base: 66.98% // Head: 66.98% // No change to project coverage 👍

Coverage data is based on head (0d9d43d) compared to base (32593be).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1822   +/-   ##
=======================================
  Coverage   66.98%   66.98%           
=======================================
  Files         173      173           
  Lines        5875     5875           
  Branches     1575     1575           
=======================================
  Hits         3935     3935           
  Misses       1929     1929           
  Partials       11       11           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@korniltsev korniltsev merged commit f474c2d into main Jan 30, 2023
@korniltsev korniltsev deleted the fix/pprof_parsing_stack_hashing_allocations branch January 30, 2023 10:50
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.

2 participants