Skip to content

bevy_reflect: Use active_types instead of active_fields where appropriate #19922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nnethercote
Copy link
Contributor

Objective

Follow on fixes for #19876, using active_types instead of active_fields where appropriate.

Helps a tiny bit with #19873.

Solution

  • Describe the solution used to achieve the objective above.

Testing

I checked the output of cargo expand and ran cargo run -p ci.

This could have been part of bevyengine#19876, which deduplicated the fields. It's
also simpler and more efficient to keep the (short-lived) active types
as an `IndexSet<Type>`, and avoid converting them to a `Vec<Type>` and
then a `Box<[Type]>`.
Instead of `active_fields`. This makes it match `ReflectStruct`, and
avoids redundant calls within the generated `register_type_dependencies`
when the same type is used in multiple enum variant fields.
@nnethercote nnethercote changed the title Index set Use active_types instead of active_fields where appropriate Jul 2, 2025
@nnethercote
Copy link
Contributor Author

Best reviewed one commit at a time. It looks like this repo might squash-and-rebase to land PRs? I often do multi-commit PRs so I'll give it a try here, see how it pans out.

@tychedelia tychedelia added C-Performance A change motivated by improving speed, memory usage or compile times A-Reflection Runtime information about types S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 2, 2025
@alice-i-cecile
Copy link
Member

Yep, we use squash-on-merge, so the multi-commit approach is really helpful here.

@alice-i-cecile alice-i-cecile requested a review from MrGVSV July 2, 2025 14:52
@nnethercote
Copy link
Contributor Author

Yep, we use squash-on-merge, so the multi-commit approach is really helpful here.

It's a shame that squashing loses the separation in the history. It also decreases the value of bisection, if bugs are introduced.

@nnethercote nnethercote changed the title Use active_types instead of active_fields where appropriate bevy_reflect: Use active_types instead of active_fields where appropriate Jul 2, 2025
@alice-i-cecile
Copy link
Member

Indeed :) However, it is much easier on novice contributors, and it allows us to ensure that every commit in the history compiles via CI checks, allowing for easier bisection and examination of history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Performance A change motivated by improving speed, memory usage or compile times S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants