Add benchmark and optimize performance of common functions#8
Merged
AkihiroSuda merged 3 commits intocontainerd:mainfrom Nov 27, 2025
Merged
Add benchmark and optimize performance of common functions#8AkihiroSuda merged 3 commits intocontainerd:mainfrom
AkihiroSuda merged 3 commits intocontainerd:mainfrom
Conversation
Signed-off-by: Derek McGowan <derek@mcg.dev>
Replace the URI comparison with pointer comparison, this removes all allocations during the children comparison. The register already guarantees that multiple URIs are not registered. Change the ordering of the comparison first check the most likely filter and do the set check last. Signed-off-by: Derek McGowan <derek@mcg.dev>
The URI generation is slow and unnecessary just to compare two fields. This reduces extra allocations down to 0 during registration. Signed-off-by: Derek McGowan <derek@mcg.dev>
e82becf to
60d3c68
Compare
AkihiroSuda
approved these changes
Nov 27, 2025
akhilerm
approved these changes
Nov 27, 2025
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.
Currently we use
URI()for comparison checks which causes unnecessary allocations. Directly comparing the values or pointers greatly improves performance.Another additional speedup is achieved by doing the disabled set check after the other checks, which are faster and often false when scanning over the whole registry.
Locally, I see a 20x speed improvement on graph and 40x on uniqueness check and allocations drop to zero or near zero. Its harder to measure due to init across 50+ plugins in containerd, but with this change I see a 25% speedup in containerd startup on the same machine (20ms to 15ms avg)