-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - keep track of type name in NodeState #1444
[Merged by Bors] - keep track of type name in NodeState #1444
Conversation
@@ -131,6 +132,7 @@ impl NodeState { | |||
input_slots: ResourceSlots::from(node.input()), | |||
output_slots: ResourceSlots::from(node.output()), | |||
node: Box::new(node), | |||
type_name: Some(std::any::type_name::<T>()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it always have a value? Is the Option
needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In bevy all uses of NodeState
supply the type name, so the option isn’t needed. However I wasn’t sure whether there are use cases where the type name is not available, and the size of Option<&str> is the same as &str anyway.
I don’t really care which one it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its less about size and more about adding another branch to unwrap the option (which has performance and code complexity implications). I think I'd rather opt for non-options first, then add them if/when we hit a case where they're needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it now.
d6183f3
to
5f22ea7
Compare
bors r+ |
Adds the original type_name to `NodeState`, enabling plugins like [this](https://github.com/jakobhellermann/bevy_mod_debugdump). This does increase the `NodeState` type by 16 bytes, but it is already 176 so it's not that big of an increase.
Pull request successfully merged into main. Build succeeded: |
Adds the original type_name to
NodeState
, enabling plugins like this.This does increase the
NodeState
type by 16 bytes, but it is already 176 so it's not that big of an increase.