-
Notifications
You must be signed in to change notification settings - Fork 368
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
Reduce the file size of flame graphs #314
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
godlygeek
force-pushed
the
shrink_flamegraphs
branch
2 times, most recently
from
February 7, 2023 06:08
dced1e8
to
bb345cb
Compare
godlygeek
changed the title
Reduce file size for flame graphs
Reduce the file size of flame graphs
Feb 7, 2023
pablogsal
reviewed
Feb 7, 2023
pablogsal
reviewed
Feb 7, 2023
pablogsal
reviewed
Feb 7, 2023
pablogsal
approved these changes
Feb 7, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is fantastic!
I left two nits
godlygeek
force-pushed
the
shrink_flamegraphs
branch
from
February 7, 2023 19:45
bb345cb
to
7ae0e5a
Compare
Rather than turning our entire deeply nested tree into JSON, encode the data that it contains in a more compressed form. Replace all references to strings with lookups in a table of strings. Pass all node attributes as arrays, where the Nth element represents the value of that attribute for the Nth node, and represent relationships to other nodes as indices into this array. Reconstruct the tree in the flame graph JavaScript, to scope the change to just the boundary between Python and JavaScript. Additionally, consistently represent line numbers as integers rather than strings. Previously we represented the root node's line number as an integer and all other nodes' line numbers as strings. Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Jinja uses the default `json.dumps` separators by default, which put an unnecessary space after every `:` and `,` added in the JSON representation for readability. Since we don't intend this data to be human readable, ask Jinja to encode it more compactly. Support for this functionality was added in Jinja2 2.9, so declare a dependency on at least that version. Also, stop depending on the `types-Jinja2` package for type checking, as Jinja2 itself now has (more complete) type annotations. Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
godlygeek
force-pushed
the
shrink_flamegraphs
branch
from
February 7, 2023 19:54
7ae0e5a
to
2752225
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These two changes combined result in a flame graph that's 85% smaller for the nbody example program in
--trace-python-allocators
and--native
mode.