A lot of perf micro-optimisations (#20188)

* Refactors Investigate Log

* Speedup character loading

* Optimise SSinstancing

* Removes both path images

* Optimises SSdebugview

* CRLF --> LF

* Update config/example/config.toml
This commit is contained in:
AffectedArc07
2023-01-14 20:01:16 +00:00
committed by GitHub
parent bf61975b2a
commit 0db3259f47
25 changed files with 79 additions and 145 deletions
+4
View File
@@ -7,6 +7,10 @@ SUBSYSTEM_DEF(debugview)
var/list/client/processing = list()
/datum/controller/subsystem/debugview/fire(resumed)
// Dont generate text if no one is there to look at it
if(!length(processing))
return
// Generate debug text
var/list/entries = list()
entries += "CPU: [round(world.cpu, 1)] | MCPU: [round(world.map_cpu, 1)] | FPS/TPS: [world.fps] | Clients: [length(GLOB.clients)] | BYOND: [world.byond_version].[world.byond_build]"
+17 -1
View File
@@ -14,7 +14,7 @@ SUBSYSTEM_DEF(instancing)
CRASH("SSinstancing was set to init before SSredis. Who broke it?")
// Dont even bother if we arent connected to redis or the DB
if(!SSdbcore.IsConnected() || !SSredis.connected)
if(!SSdbcore.IsConnected() || !SSredis.connected || !GLOB.configuration.system.enable_multi_instance_support)
flags |= SS_NO_FIRE
return ..()
@@ -43,6 +43,10 @@ SUBSYSTEM_DEF(instancing)
update_playercache()
/datum/controller/subsystem/instancing/proc/execute_command(source, command, list/arguments)
// We aint enabled. Dont bother.
if(!GLOB.configuration.system.enable_multi_instance_support)
return
var/datum/server_command/SC = registered_commands[command]
if(!SC)
CRASH("Attempted to execute command with ID '[command]' from [source], but that command didnt exist!")
@@ -58,6 +62,10 @@ SUBSYSTEM_DEF(instancing)
* Updates the player cache in the DB. Different from heartbeat so we can force invoke it on player operations
*/
/datum/controller/subsystem/instancing/proc/update_playercache(optional_ckey)
// We aint enabled. Dont bother.
if(!GLOB.configuration.system.enable_multi_instance_support)
return
// You may be wondering, why the fuck is an "optional ckey" variable here
// Well, this is invoked in client/New(), and needs to read from GLOB.clients
// However, this proc sleeps, and if you sleep during client/New() once the client is in GLOB.clients, stuff breaks bad
@@ -111,6 +119,10 @@ SUBSYSTEM_DEF(instancing)
* This is called during world/New() instead of on initialize so it can be done *instantly*
*/
/datum/controller/subsystem/instancing/proc/seed_data()
// We aint enabled. Dont bother.
if(!GLOB.configuration.system.enable_multi_instance_support)
return
// We need to seed a lot of keys, so lets just use a key-value-pair-map to do this easily
var/list/kvp_map = list()
kvp_map["server_name"] = GLOB.configuration.general.server_name // Name of the server
@@ -145,6 +157,10 @@ SUBSYSTEM_DEF(instancing)
* ckey - The ckey to check if they are logged into another server
*/
/datum/controller/subsystem/instancing/proc/check_player(ckey)
// We aint enabled. Dont bother.
if(!GLOB.configuration.system.enable_multi_instance_support)
return
// Please see above rant on L127
var/datum/db_query/dbq1 = SSdbcore.NewQuery({"
SELECT server_id, key_value FROM instance_data_cache WHERE server_id IN