-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Pre-parsed paths for GetPath functions #4080
Copy link
Copy link
Closed
Labels
A-AnimationMake things move and change over timeMake things move and change over timeA-ReflectionRuntime information about typesRuntime information about typesC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile times
Metadata
Metadata
Assignees
Labels
A-AnimationMake things move and change over timeMake things move and change over timeA-ReflectionRuntime information about typesRuntime information about typesC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile times
What problem does this solve or what need does it fill?
Being able to access
&(mut) dyn Reflectfields from a largerdyn ReflectviaGetPathis a very nice QOL option when loading scenes or just looking for a runtime reflection. However, repeatedly calling it's functions with the same string is wasteful as it re-parses the same string at every call.What solution would you like?
It'd be ideal to have alternative APIs for parsing a field path ahead of time, and just using the parsed token stream or access-list.
Ideally this would also look up type registrations, possibly using static type information (#4042) to look up field numbers instead of using string based lookups to help further cut down on string operations on this fast-path.
What alternative(s) have you considered?
path,path_mut,get_path, andget_path_mut. This would work for this one use case, but wouldn't be generically available as a fast-path for other use cases.Additional context
This is an optional, but highly recommended optimization for #4026 to enable faster application of animated values.
The current code already tokenizes individual parts of the path. We'd just need to decouple this into a separate
'statictoken stream that can be used as an alternative input.