Skip to content

Some improvements for libpod#28812

Open
bit-hope wants to merge 3 commits into
containers:mainfrom
bit-hope:improvements-for-libpod
Open

Some improvements for libpod#28812
bit-hope wants to merge 3 commits into
containers:mainfrom
bit-hope:improvements-for-libpod

Conversation

@bit-hope
Copy link
Copy Markdown
Contributor

@bit-hope bit-hope commented May 29, 2026

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

None

bit-hope added 3 commits May 29, 2026 10:13
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>
@bit-hope bit-hope changed the title Som improvements for libpod Some improvements for libpod May 29, 2026
Comment thread libpod/pod_status.go
return createPodStatusResults(ctrStatuses)
}

func createPodStatusResults(ctrStatuses map[string]define.ContainerStatus) (string, error) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about a unit test for this to satisfy the needs tests requirement ?

Copy link
Copy Markdown
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, once CI is green.

I agree with @baude's suggestion of unit test.

Comment thread libpod/runtime_ctr.go
}
}
i := 0
nextEthIdx := 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love this change!

@TomSweeneyRedHat
Copy link
Copy Markdown
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

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.

4 participants