-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Replay subsystem fixes + optimizations #4771
Conversation
…d of `can_fire`, add `Recover()` implementation
tested locally and everything seems to work fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just explaining the reasons behind some of my changes here
@@ -495,4 +537,4 @@ SUBSYSTEM_DEF(demo) | |||
if(marked_dirty[M]) | |||
marked_dirty -= M | |||
if(initialized) | |||
del_list["\ref[M]"] = 1 | |||
del_list[ref(M)] = TRUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i benchmarked it - lone ref(thing)
is faster than lone "\ref[thing]"
- but only by itself, \ref[thing]
is faster when part of a larger string
// use for stuff that should appear in the main/targetless chat panel | ||
/datum/controller/subsystem/demo/proc/write_chat_global(text) | ||
if(disabled) | ||
return | ||
var/json_encoded = json_encode(text) | ||
write_event_line("chat global [last_chat_message == json_encoded ? "=" : json_encoded]") | ||
last_chat_message = json_encoded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs yogstation13/demo-viewer#42 in order to properly show in the viewer, but it won't break viewing replays without that PR, it just won't show the global messages.
|
||
// write a "snapshot" of the world at this point. | ||
// start with turfs | ||
log_world("Writing turfs...") | ||
WRITE_LOG_NO_FORMAT(GLOB.demo_log, "init [world.maxx] [world.maxy] [world.maxz]\n") | ||
marked_turfs.Cut() | ||
marked_turfs.len = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list.len = 0
is slightly faster than list.Cut()
according to zewaka and kapu in coderbus
//var/last_queued = 0 | ||
//var/last_completed = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these vars are never used anywhere anyways at the moment
msg += "}" | ||
return ..() | ||
|
||
/datum/controller/subsystem/demo/proc/disable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to its own proc to avoid code repetition in case it needs to be disabled outside of init
WRITE_LOG_NO_FORMAT(GLOB.demo_log, "[line]\n") | ||
else | ||
pre_init_lines += line | ||
var/disabled = FALSE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm adding this var instead of just using can_fire
like I did previously so it can be manually paused without disabling it
|
||
/client/Del() | ||
/client/Destroy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/client/Del()
calls Destroy() anyways
/client/New() | ||
SSdemo.write_event_line("login [ckey]") | ||
. = ..() | ||
return ..() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same effect, but better to read imo
if(isturf(changed_on)) { \ | ||
SSdemo.mark_turf(changed_on); \ | ||
} else if(isobj(changed_on) || ismob(changed_on)) { \ | ||
SSdemo.mark_dirty(changed_on); \ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's a turf, then it's not an obj or mob, so changing to else if
here should a tiny few cpu cycles
also formatted it better so it's less of an eyesore
About The Pull Request
memory usage go brrr
Changelog
🆑
fix: Fixed the replays subsystem still marking objects when disabled.
qol: Optimized the replays subsystem a bit.
/:cl: