Pre-sort PDA messengers by name/job instead of sorting every time we list them (#92613)

## About The Pull Request

this gets rid of the `get_messengers_sorted_by_name` and
`get_messengers_sorted_by_job` procs, instead replacing them with two
new global lists: `GLOB.pda_messengers_by_name` and
`GLOB.pda_messengers_by_job`

those two lists are updated in the `add_messenger` proc, which uses the
binary insert macros to insert it into the properly sorted place.

why? bc sorts suck for performance and all inserts/removals to this list
go thru a single proc anyways, so we can just ensure it's sorted like
this once, instead of re-sorting each time.

thanks to @LemonInTheDark for helping me with this

<details>
<summary><h3>Testing Proof</h3></summary>

<img width="1708" height="1349" alt="2025-08-16 (1755391989) ~
dreamseeker"
src="https://github.com/user-attachments/assets/1e2dc99a-1863-4a35-8032-8ae64706fdaa"
/>

<img width="1708" height="1349" alt="2025-08-16 (1755392002) ~
dreamseeker"
src="https://github.com/user-attachments/assets/4d9b3bd0-7f3a-410b-a073-1bf2bd69690b"
/>

</details>

## Why It's Good For The Game

because doing a sort repeatedly whenever someone has their PDA messenger
open is stupid and sucks

## Changelog

no player-facing changes
This commit is contained in:
Lucy
2025-08-17 18:15:18 -04:00
committed by GitHub
parent c80361d5f3
commit 5d8bddfcf4
5 changed files with 21 additions and 23 deletions
@@ -56,8 +56,7 @@
data["ntnetlogs"] += list(list("entry" = i))
data["tablets"] = list()
for(var/messenger_ref in get_messengers_sorted_by_name())
var/datum/computer_file/program/messenger/app = GLOB.pda_messengers[messenger_ref]
for(var/datum/computer_file/program/messenger/app as anything in GLOB.pda_messengers_by_name)
var/obj/item/modular_computer/pda = app.computer
var/list/tablet_data = list()