Optimize build: Simplify and cleanup ComposePlugin and DeterminePlugin (Part 3)#918
Open
azeey wants to merge 4 commits into
Open
Optimize build: Simplify and cleanup ComposePlugin and DeterminePlugin (Part 3)#918azeey wants to merge 4 commits into
azeey wants to merge 4 commits into
Conversation
Replaced the legacy custom implementation of `void_t` in `TemplateHelpers.hh` with `std::void_t` from `<type_traits>`, fulfilling the existing TODO to migrate to standard C++17 metaprogramming types. Generated-By: Gemini 3.0 Pro Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
Replaced the recursive template traversal in `InspectFeatures` with flat C++17 fold expressions over the `FeatureTuple`. This significantly reduces compile-time template instantiation depth and improves runtime performance for feature verification. Generated-By: Gemini 3.0 Pro Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
This commit introduces a lightweight `TypeList` to replace `std::tuple` for intermediate template metaprogramming operations (filtering, flattening, and deduping feature lists). By using `TypeList` and C++17 fold expressions instead of recursive `std::tuple` instantiations, we drastically reduce compiler memory consumption (Max RSS) and build times. The public API retains `std::tuple` for backward compatibility, but internal operations are fully modernized. Generated-By: Gemini 3.0 Pro Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
…st walk This commit drastically simplifies the feature aggregation logic by replacing the legacy binary-tree `ComposePlugin`, `CheckRequirements`, and `IterateList` mechanisms with a simple tail-recursive `ComposePluginFromList`. Because `ExtractAPI` already computes a flat `TypeList` of unique base classes, we can feed those directly into `ComposePluginFromList` to construct the linear inheritance chain of `SpecializedPlugin`s required by `gz-plugin` without the need for complex `std::is_void_v` branching. This completely removes the need for `GetNext`, `IterateList`, and `Aggregate`. Added documentation explaining the linear inheritance chain. Generated-By: Gemini 3.0 Pro Signed-off-by: Addisu Z. Taddese <addisuzt@intrinsic.ai>
ahcorde
approved these changes
Mar 25, 2026
11 tasks
Contributor
|
@azeey , there are some conflicts. |
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.
🎉 New feature
Needs:
std::void_t(Part 1) #916Summary
This PR simplifies the feature aggregation logic by replacing the binary-tree
ComposePlugin,CheckRequirements, andIterateListmechanisms with a simple tail-recursiveComposePluginFromList.In addition, because
ExtractAPIalready computes a flatTypeListof unique base classes, we can feed those directly intoComposePluginFromListto construct the linear inheritance chain ofSpecializedPlugins required bygz-pluginwithout the need for complexstd::is_void_vbranching.This completely removes the need for
GetNext,IterateList, andAggregate.Test it
Compare against
mainby building the code while measuring memory consumptionI get similar results as in #917, with slightly less memory consumption. The point of this PR is to simplify and clean up the code.
Checklist
codecheckpassed (See contributing)Generated-by: Gemini 3.0 Pro
Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-byandGenerated-bymessages.Backports: If this is a backport, please use Rebase and Merge instead.