Refactors filters to utilize binary insertion instead of timSort (#93053)

## About The Pull Request

update_filters() is more expensive than it should be due to running
timSort every time a filter is added or removed, plus we wipe
re-initialize the entire atom filter list every time we call it. I
swapped it to use binary insertion into the main list, and we can cut
down on the amount of filter churn by storing filters in a separate list
which we can use Insert on, which allows us to stop constantly deleting
and recreating filters completely.

## Why It's Good For The Game

Server CPU consumption go down

## Changelog
🆑
refactor: Refactored filters to utilize binary insertion instead of
timSort. The server should run somewhat faster now, hopefully.
/🆑
This commit is contained in:
SmArtKar
2025-09-21 14:48:38 +02:00
committed by GitHub
parent 739692a5cc
commit 4a2efa2928
7 changed files with 138 additions and 100 deletions
@@ -33,8 +33,7 @@
consider making a new render plate that they can both draw to instead, or something of that nature.")
// Now we walk for filters that take from us
for(var/filter_id in plane.filter_data)
var/list/filter = plane.filter_data[filter_id]
for(var/list/filter in plane.filter_data)
if(!filter["render_source"])
continue
var/atom/movable/screen/plane_master/target = render_target_to_plane[filter["render_source"]]