cmd: introduce profiling options#516
Merged
Merged
Conversation
Member
|
Would it make sense to use build tags here? That way we can add them for debug builds and stuff. I'm not sure if we want to have these flags be part of our release builds. |
supakeen
reviewed
May 13, 2026
Member
supakeen
left a comment
There was a problem hiding this comment.
I'd like to have these things but like @croissanne says they should be behind a build flag/tag so we don't ship this in production executables.
Contributor
Author
|
Sure, rebased. |
brlane-rht
reviewed
May 14, 2026
brlane-rht
previously approved these changes
May 14, 2026
brlane-rht
left a comment
There was a problem hiding this comment.
Looks good other than my one small comment.
Contributor
Author
|
Rebased your suggestion, also added a bit of documentation to each method. |
supakeen
approved these changes
May 20, 2026
Member
|
Will need a rebase on #520 which contains the fix for CI. Let's do that after it hits main so we don't lose acks here. |
After json.Indent fills a bytes.Buffer, stream the buffer to the output writer with WriteTo instead of fmt.Fprintf(..., pretty.String()). That avoids allocating a second copy of the entire indented manifest as a string, which matters for large manifests. Co-authored-by: Cursor <cursoragent@cursor.com>
These are only available when building with the DEBUG=1 make target.
Contributor
Author
|
Rebased. |
This file contains hidden or 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
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.
Add persistent flags --memprofile, --memprofile-goroutine, and --memprofile-rate. Heap and goroutine profiles are written in Go pprof format when the process exits, including on command failure, so runs can be analyzed with the toolchain from go.mod (e.g. go tool pprof).
When profiling is off, allocation sampling is not enabled for the image-builder CLI: MemProfileRate is reset at the start of run() and stays zero unless a command sets --memprofile, in which case MemProfileRate follows --memprofile-rate (-1 means Go's default 524288).