You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: reduce memory consumption by eliminating redundant string copies (#965)
* fix: reduce memory consumption by eliminating redundant string copies
Changes manifest.Parse and parseContent to accept []byte instead of
string, avoiding a full copy of the entire manifest when converting from
the raw helm output bytes. Raw byte slices are released after parsing
to allow GC reclamation before diff computation begins.
Also adds a content length ratio check in rename detection to skip
obviously different resources before computing expensive full diffs.
Closes#915
Signed-off-by: yxxhero <aiopsclub@163.com>
* fix: remove ineffectual nil assignments flagged by linter
The releaseManifest and installManifest nil assignments were flagged
by ineffassign since the variables are not read afterward. The main
memory optimization comes from the []byte signature change.
Signed-off-by: yxxhero <aiopsclub@163.com>
* fix: address PR review comments for reduce memory consumption
- Replace append copy in Parse with io.MultiReader to avoid
manifest copy
- Extract length ratio constants for named constants
Add unit tests for length ratio heuristic
- Restructure cmd flows to parse into locals before diff
release raw bytes earlier
Signed-off-by: yxxhero <aiopsclub@163.com>
* fix: address all PR review comments
- Nil out raw manifest byte slices after parsing in upgrade/release/rollback/revision
to allow GC reclamation before diff computation
- Fix unkeyed Options struct literals in diff_test.go (4 locations) to use
keyed field names for resilience against struct changes
- Skip length-ratio filter for Secrets in contentSearch() since Secret raw
content lengths before redaction/decoding are unreliable rename predictors
- Extract empty-content check before the Secret kind branch (DRY)
Agent-Logs-Url: https://github.com/databus23/helm-diff/sessions/c2d2d0b3-3840-48a8-89f0-4b6913c83973
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
* fix: suppress ineffassign warnings on GC-hint nil assignments
Add //nolint:ineffassign comments on the nil assignments that are
intentionally written to allow GC to reclaim raw manifest bytes
before the diff computation begins. The ineffassign linter correctly
identifies these as never-read-after-assignment, but the intent is
a deliberate GC hint for long-running diff operations.
Agent-Logs-Url: https://github.com/databus23/helm-diff/sessions/aa2df3f5-57bb-4939-ac45-3f3612deac60
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
---------
Signed-off-by: yxxhero <aiopsclub@163.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
0 commit comments