egui
egui copied to clipboard
Performance: replace bools in `Response` with bit-sets
Response is 88 bytes large. Around 26 bytes of that is because of as many bools, which could be combines into a few bit-sets instead of 4 bytes.
This also includes Sense which has the same problem.
We also have several; [bool; NUM_POINTER_BUTTONS] which could be replaced with a bit-set each (PointerButtons or something).
Ideally we could solve this in an ergonomic way without any additional additional dependencies.
Is adding bitflags such a big deal? It's a pretty small dependency, and most egui projects probably already depend on it anyway (it appears 39 times in this repo's lock file). It would save a lot of boilerplate.
I would love to take this on!
I think adding a dependency on bitflags is fine
Hey im pretty new but I have been trying to learn rust from docs and videos, I wanted to see if I could help with this project and saw this was a good first issue. I would love to help as much as possible but I still have a lot to learn!
Heya,
I've started work on this since it seems like fun. I'm about halfway through Response.
edit: Response is done
I've managed to get it working without any extra dependencies! just math.
Question: Sense literally just contains bools, should be be a struct containing u64?
pub struct Sense (u64);
The initial implementation is complete, all tests have passed. https://github.com/toastxc/egui