-
Notifications
You must be signed in to change notification settings - Fork 848
Description
Feature Request
Crates
- tracing-subscriber
Motivation
The typemap-based used by the Registry's to store extensions is a typemap that erases types, places them into a Box, and stores the box into a HashMap. While this makes it easy to get started with the Registry, this approach does have a noticeable overhead when used in contexts such as profiling (e.g., bevyengine/bevy#4892).
Proposal
Instead of using a HashMap for extensions, Layer types would be required to pre-declare extension types they'd be storing in the Registry and use arrays to store extensions, avoiding the boxing (and potentially, the HashMap lookup).
Alternatives
Don't do this, but I think that the performance benefits of this are non-trivial.
(Sorry this issue is a bit short, I had to run and most of the implementation details will be discovered while creating this API.)