-
Bug
-
Resolution: Invalid
-
None
-
1.19.3, 23w04a
-
None
-
Confirmed
-
Commands, Performance
The bug
As with MC-159633, an unused component is created when a command fails during function execution. Furthermore, the component is stringified to be passed to the Exception constructor. This imposes a constant overhead for typical command failures and a linear overhead for some command failures.
Example
The following command takes a linear time for the deep size of the target NBT on failure because it creates an exception message "Expected list, got: …" where … is the stringified target NBT.
data modify storage _ _ append value 0b
Code analysis
If a command fails, a CommandSyntaxException is eventually created in most cases.
public CommandSyntaxException(final CommandExceptionType type, final Message message) { super(message.getString(), null, ENABLE_COMMAND_STACK_TRACES, ENABLE_COMMAND_STACK_TRACES); this.type = type; this.message = message; this.input = null; this.cursor = -1; }
The created component is converted to a string in message.getString(), but that string and the component are never used during normal function execution.
- relates to
-
MC-159633 Command feedback messages are unnecessarily created during function execution
- Resolved