Lighting performance/profiling tweaks

- Lighting process now yields at 10% of a tick and defers at 80% of a
tick
- There is no longer a limit to how many sources/corners/overlays will
update in a single work run
- Source/corner/overlay totals are now simple counts instead of lists
- Lighting update stats now show updates over each of the previous 5
seconds
- Space turfs now remove their starlight when changing to a different
turf, fixing a runtime
This commit is contained in:
Krausus
2017-02-19 23:37:54 -05:00
parent 298874e1ba
commit 471d1d9c98
5 changed files with 43 additions and 46 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
/var/list/datum/lighting_corner/all_lighting_corners = list()
/var/total_lighting_corners = 0
/var/datum/lighting_corner/dummy/dummy_lighting_corner = new
// Because we can control each corner of every lighting overlay.
// And corners get shared between multiple turfs (unless you're on the corners of the map, then 1 corner doesn't).
@@ -32,7 +32,7 @@
/datum/lighting_corner/New(var/turf/new_turf, var/diagonal)
. = ..()
all_lighting_corners += src
total_lighting_corners++
masters[new_turf] = turn(diagonal, 180)
z = new_turf.z
+3 -3
View File
@@ -1,4 +1,4 @@
var/list/all_lighting_overlays = list() // Global list of lighting overlays.
/var/total_lighting_overlays = 0
/atom/movable/lighting_overlay
name = ""
mouse_opacity = 0
@@ -21,7 +21,7 @@ var/list/all_lighting_overlays = list() // Global list of lighting overlays.
/atom/movable/lighting_overlay/New(var/atom/loc, var/no_update = FALSE)
. = ..()
verbs.Cut()
global.all_lighting_overlays += src
total_lighting_overlays++
var/turf/T = loc //If this runtimes atleast we'll know what's creating overlays outside of turfs.
T.lighting_overlay = src
@@ -77,7 +77,7 @@ var/list/all_lighting_overlays = list() // Global list of lighting overlays.
return
/atom/movable/lighting_overlay/Destroy()
global.all_lighting_overlays -= src
total_lighting_overlays--
global.lighting_update_overlays -= src
global.lighting_update_overlays_old -= src
+3 -3
View File
@@ -1,4 +1,4 @@
/var/list/datum/light_source/all_lighting_sources = list()
/var/total_lighting_sources = 0
// This is where the fun begins.
// These are the main datums that emit light.
@@ -32,7 +32,7 @@
var/force_update
/datum/light_source/New(var/atom/owner, var/atom/top)
all_lighting_sources += src
total_lighting_sources++
source_atom = owner // Set our new owner.
if(!source_atom.light_sources)
source_atom.light_sources = list()
@@ -62,7 +62,7 @@
// Kill ourselves.
/datum/light_source/proc/destroy()
all_lighting_sources -= src
total_lighting_sources--
destroyed = TRUE
force_update()
if(source_atom)