[MIRROR] Startup Time Optimization (#10940)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-05-24 18:44:27 -07:00
committed by GitHub
parent 51d87471f7
commit 7f4da4eb22
13 changed files with 60 additions and 24 deletions

View File

@@ -56,6 +56,28 @@
#endif
return (AIR_BLOCKED*!CanZASPass(other, FALSE))|(ZONE_BLOCKED*!CanZASPass(other, TRUE))
/turf/proc/self_airblock()
if(blocks_air & AIR_BLOCKED)
return BLOCKED
if(blocks_air & ZONE_BLOCKED)
return ZONE_BLOCKED
var/result = 0
for(var/atom/movable/M as anything in contents)
switch(M.can_atmos_pass)
if(ATMOS_PASS_YES)
continue
if(ATMOS_PASS_NO)
return BLOCKED
if(ATMOS_PASS_DENSITY)
if(M.density)
return BLOCKED
if(ATMOS_PASS_PROC)
result |= M.c_airblock(src)
if(result == BLOCKED) return BLOCKED
return result
/turf/c_airblock(turf/other)
#ifdef ZASDBG
ASSERT(isturf(other))

View File

@@ -55,7 +55,7 @@
return
if(direction == "N/A")
if(!(T.c_airblock(T) & AIR_BLOCKED))
if(!(T.self_airblock() & AIR_BLOCKED))
to_chat(mob, "The turf can pass air! :D")
else
to_chat(mob, "No air passage :x")

View File

@@ -11,7 +11,7 @@
vis_contents -= graphic_remove
/turf/proc/update_air_properties()
var/block = c_airblock(src)
var/block = self_airblock()
if(block & AIR_BLOCKED)
//dbg(blocked)
return 1
@@ -139,8 +139,7 @@
c_copy_air()
zone = null //Easier than iterating through the list at the zone.
var/s_block // CHOMPEdit
ATMOS_CANPASS_TURF(s_block, src, src)
var/s_block = self_airblock()
if(s_block & AIR_BLOCKED)
#ifdef ZASDBG
if(verbose) to_world("Self-blocked.")

View File

@@ -7,8 +7,10 @@
// This allows us to get the real details of everything lagging at server start.
// world.Profile(PROFILE_START)
#if defined(ENABLE_BYOND_TRACY)
var/tracy_init = call_ext("prof.dll", "init")() // Setup Tracy integration
if(tracy_init != "0")
var/tracy_init = LIBCALL("prof.dll", "init")() // Setup Tracy integration
if(length(tracy_init) != 0 && tracy_init[1] == ".") // it returned the output file
to_world_log("TRACY Enabled, streaming to [tracy_init].")
else if(tracy_init != "0")
CRASH("Tracy init error: [tracy_init]")
#endif
// After that, the debugger is initialized.

View File

@@ -219,7 +219,7 @@ Total Unsimulated Turfs: [world.maxx*world.maxy*world.maxz - simulated_turf_coun
var/turf/T = currentrun[currentrun.len]
currentrun.len--
//check if the turf is self-zone-blocked
if(T.c_airblock(T) & ZONE_BLOCKED)
if(T.self_airblock() & ZONE_BLOCKED)
selfblock_deferred += T
if(MC_TICK_CHECK)
return

View File

@@ -43,7 +43,7 @@
/turf/simulated/floor/LateInitialize()
. = ..()
update_icon(1)
update_icon()
/turf/simulated/floor/proc/swap_decals()
var/current_decals = decals

View File

@@ -178,7 +178,6 @@ var/list/mining_overlay_cache = list()
update_general()
/turf/simulated/mineral/proc/update_general()
update_icon(1)
recalculate_directional_opacity()
if(ticker && ticker.current_state == GAME_STATE_PLAYING)
reconsider_lights()
@@ -212,7 +211,7 @@ var/list/mining_overlay_cache = list()
make_ore()
if(prob(20))
overlay_detail = "asteroid[rand(0,9)]"
update_icon(1)
update_icon(!mapload)
if(density && mineral)
. = INITIALIZE_HINT_LATELOAD
if(random_icon)
@@ -223,8 +222,7 @@ var/list/mining_overlay_cache = list()
if(density && mineral)
MineralSpread()
/turf/simulated/mineral/update_icon(var/update_neighbors)
/turf/simulated/mineral/update_icon(var/update_neighbors, ignore_list)
cut_overlays()
//We are a wall (why does this system work like this??)
@@ -240,7 +238,7 @@ var/list/mining_overlay_cache = list()
//Apply overlays if we should have borders
for(var/direction in GLOB.cardinal)
var/turf/T = get_step(src,direction)
if(istype(T) && !T.density)
if(T && !T.density)
add_overlay(get_cached_border(rock_side_icon_state,direction,icon,rock_side_icon_state))
if(archaeo_overlay)
@@ -260,13 +258,12 @@ var/list/mining_overlay_cache = list()
//Apply overlays if there's space
for(var/direction in GLOB.cardinal)
if(istype(get_step(src, direction), /turf/space) && !istype(get_step(src, direction), /turf/space/cracked_asteroid))
var/turf/T = get_step(src, direction)
if(istype(T, /turf/space) && !istype(T, /turf/space/cracked_asteroid))
add_overlay(get_cached_border("asteroid_edge",direction,icon,"asteroid_edges", 0))
//Or any time
else
var/turf/T = get_step(src, direction)
if(istype(T) && T.density)
if(T?.density)
add_overlay(get_cached_border(rock_side_icon_state,direction,rock_icon_path,rock_side_icon_state))
if(overlay_detail)
@@ -274,12 +271,16 @@ var/list/mining_overlay_cache = list()
if(update_neighbors)
for(var/direction in GLOB.alldirs)
if(istype(get_step(src, direction), /turf/simulated/mineral))
var/turf/simulated/mineral/M = get_step(src, direction)
M.update_icon()
if(istype(get_step(src, direction), /turf/simulated/wall/solidrock))
var/turf/simulated/wall/solidrock/M = get_step(src, direction)
M.update_icon()
var/turf/T = get_step(src, direction)
// don't double update during cave generation
if(LAZYACCESS(ignore_list, T))
continue
if(istype(T, /turf/simulated/mineral))
T.update_icon()
if(istype(T, /turf/simulated/wall/solidrock))
T.update_icon()
/turf/simulated/mineral/ex_act(severity)

View File

@@ -2,6 +2,7 @@
iterations = 5
descriptor = "moon caves"
var/list/ore_turfs = list()
var/list/turfs_changed
var/make_cracked_turfs = TRUE
/datum/random_map/automata/cave_system/no_cracks
@@ -68,6 +69,7 @@
new /obj/structure/mob_spawner/scanner/mining_animals(T) //CHOMP Add
else
T.make_wall()
LAZYSET(turfs_changed, T, TRUE)
if(T.density && !T.ignore_oregen)
if(map[current_cell] == DOOR_CHAR)
@@ -77,3 +79,11 @@
get_additional_spawns(map[current_cell],T,get_spawn_dir(x, y))
//VOREStation Edit End
return T
/datum/random_map/automata/cave_system/apply_to_map()
. = ..()
for(var/turf/simulated/mineral/T as anything in turfs_changed)
T.update_icon(1, turfs_changed)
LAZYCLEARLIST(turfs_changed)

Binary file not shown.

BIN
prof.dll

Binary file not shown.

Binary file not shown.

View File

@@ -20,6 +20,7 @@ const_format = "0.2.33"
eyre = "0.6.12"
meowtonin = { git = "https://github.com/Absolucy/meowtonin.git" }
rand = "0.8.5"
rayon = "1.10.0"
[build-dependencies]
bosion = "1.1.1"

View File

@@ -1,5 +1,6 @@
use meowtonin::{value::ByondValue, ByondError, ByondResult};
use rand::{distributions::Bernoulli, prelude::Distribution};
use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator};
const CELL_THRESHOLD: usize = 5;
@@ -18,7 +19,7 @@ pub fn generate_automata(
let mut map = seed_map(limit_x, limit_y, initial_wall_cell)?;
for _ in 1..iterations {
map = map
.iter()
.par_iter()
.enumerate()
.map(|(i, _)| {
let mut count = 0;