Investigate replacing Input internals with bitsets
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
For binary inputs, as `Input` is made for, bitsets tend to be more compact and have generally have better CPU performance than HashSets and use less memory. Full set operations are vectorizable, and set membership checks are single bit tests.
## What solution would you like?
Replace the HashSets with `fixedbitset` or some other bitset implementation.
This will require making some assumptions about the nature of some input types. For example, gamepad inputs currently support arbitrary controller and button counts, which makes it difficult to map a gamepad/button combination into a bitset index. However, it's exceedingly rare to find a gamepad that has more than 255 buttons, so if we can restrict that, we can use `256 * gamepad index + button index` as the bitset index for a gamepad button.
## What alternative(s) have you considered?
Leave it as is.
## Additional context
I'm primarily filing this bug to jot down an idea that's been popping up here and there. I personally think this is a very low priority performance optimization.
Contributor guide
Assessment
This issue has not been assessed yet.