DenizenScript/Denizen

Debug Update

BloodEko opened this issue · 1 comments

Summary
Adopt a more efficient representation of the debug.

Goals
Reduce the duplication of queue information in the debug
to improve readability, reduce log size and memory consumption.

Non-Goals
It is not the goal to rework the debug and its symbols/colors in-depth.
Though further investigations, could also check on these aspects.

Motivation
Currently queue information and colors take a lot of space in relation to the commands
itself. In most cases queues run instantly, so it is not needed to print queue information
between each command. In the other case we have delayed queues where execution
changes frequently. In both situations we have too much output hiding either the
execution switches or the command values.

Description
We strip away all debug output of queue names for the commands itself. Instead, only
when a queue starts, ends, or execution switches a message is printed. The latter would
mean, when a command calls the debug, its queue is compared to the queue of the
prior running command. If they are unequal, information about a switch is printed. So, a
check like if (lastQueue != cmd.queue) would be included in the debug engine to filter
for that condition.

Risks and Assumptions
It seems to be a rather small change, as the commands already submit all the information,
which then just needs to be filtered in the debug layer. As denizen commands always
run on the main thread reading and writing the lastQueue should be nothing to worry
about. To be still safe for the future, a synchronized block could be used to protect its
state. Performance should not be altered, as the locking only happens, when debugging
is enabled and probably would also be optimized away for only a single thread.

Support is on Discord @ https://discord.gg/Q6pZGSR