DashMap is, internally, a Box<[RwLock<HashMap<K, V, S>>]>, with that internal slice having size num_threads4. This is highly useful and great... if you're accessing it from more than one thread. Instead, we're accessing it from a thread_local, and not just that, but a thread local which it is an actual impossibility to access from any thread other than the main Byond thread without invoking undefined behavior in the first place*.
To that end, I've made all the thread_locals thereof also raw static muts, which are quite a bit faster. This also replaces every thread local in the codebase which it is actually possible to replace, mind--there's one still left over, but there's no reason not to have that there.
I also replaced a few match chains with proper Option and-map-or function chains, cause I just sorta tend to do this when I see it.
DashMap is, internally, a Box<[RwLock<HashMap<K, V, S>>]>, with that internal slice having size num_threads4. This is highly useful and great... if you're accessing it from more than one thread. Instead, we're accessing it from a thread_local, and not just that, but a thread local which it is an actual impossibility to access from any thread other than the main Byond thread without invoking undefined behavior in the first place*.
To that end, I've made all the thread_locals thereof also raw static muts, which are quite a bit faster. This also replaces every thread local in the codebase which it is actually possible to replace, mind--there's one still left over, but there's no reason not to have that there.
I also replaced a few match chains with proper Option and-map-or function chains, cause I just sorta tend to do this when I see it.