Some improvements for libpod#28812
Open
bit-hope wants to merge 3 commits into
Open
Conversation
Eliminate unnecessary map construction by using local variables for counting. Signed-off-by: zhongchunhe.zch <zhongchunhe.zch@qq.com>
Use maps instead of arrays to optimize lookups from O(n) to O(1). Total complexity drops from O(n*m) to O(n), yielding noticeable gains when containers have many network attachments. Signed-off-by: zhongchunhe.zch <zhongchunhe.zch@qq.com>
Pre-allocate slice capacity and simplify code with generics. Signed-off-by: zhongchunhe.zch <zhongchunhe.zch@qq.com>
baude
reviewed
May 29, 2026
| return createPodStatusResults(ctrStatuses) | ||
| } | ||
|
|
||
| func createPodStatusResults(ctrStatuses map[string]define.ContainerStatus) (string, error) { |
Member
There was a problem hiding this comment.
how about a unit test for this to satisfy the needs tests requirement ?
| } | ||
| } | ||
| i := 0 | ||
| nextEthIdx := 0 |
Member
|
THe CI is happy due to the lack of a new test with this PR. Once added, this should be GTG. Changes otherwise LGTM |
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.
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?