Per Entity
sprite picking (and maybe friends) opt-out
#17108
Labels
A-Picking
Pointing at and selecting objects of all sorts
C-Performance
A change motivated by improving speed, memory usage or compile times
D-Modest
A "normal" level of difficulty; suitable for simple features or challenging fixes
S-Needs-Design
This issue requires design work to think about how it would best be accomplished
What problem does this solve or what need does it fill?
Currently
sprite_picking
is relatively expensive, I did some light testing with tracy and 200k sprites with like only 2k of them being in camera view can result in thesprite_picking
taking 500µs. Which is not much but frame time was 2.66ms so it took "only" almost 20% of frame time.I don't need picking for my sprites and in
debug
mode - without any bevy optimizations - the performace penalty is so big that you can reach single digit fps.My specific use-case aside I can imagine that some people would want picking only for some sprites and they might want to turn off picking for the rest.
What solution would you like?
For
sprite_picking
a simple component:then in the
sprite_picking
system sprite query could be modified from:to
Then users if they don't want picking for their sprites they can just add
NoSpritePicking
component to sprite entity.What alternative(s) have you considered?
I tried adding
PickingBehavior::IGNORE
to my sprites but that did not bring any speed-up.Maybe it could result in some weird behavior with
PickingBehavior
? idkI think it would be nice to have similar marking ignore components for other backends.
Maybe even global
NoPicking
component or something ?Faster and better
sprite_picking
system ?- It's currently doing filtering, sorting and filtering on all sprites...Picking being opt-in ?
Additional context
Red - current default system with/out
PickingBehavior
Yellow - my proposed feature with
NoSpritePicking
on my sprites and modified system200k sprites (2k on camera, rest off-camera), release mode
(This is for my use-case, ofc different apps won't probably see similar speed-up)
The text was updated successfully, but these errors were encountered: