Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: Skip unused string concatenation #43

Merged
merged 1 commit into from
May 19, 2024

Conversation

szuend
Copy link

@szuend szuend commented May 19, 2024

updateEntity in LogisticsTileGenericPipe currently creates debug strings that go unused in normal release builds. We can skip allocating temporary StringBuilder instances by checking the DEBUG flag directly.

Normally we'd use a format string with an additional varargs argument, but the add(Super)TraceInformation methods already use a varargs parameter to pass nested Infos. This is the pragmatic, cheap way to remove the calls from the hot path.

`updateEntity` in `LogisticsTileGenericPipe` currently creates a debug
string that goes unused in normal release builds. We can skip allocating
temporary `StringBuilder` instances by checking the DEBUG flag
directly.

Normally we'd use a format string with an additional varargs argument,
but the `add(Super)TraceInformation` methods already use a varargs
parameter to pass nested `Infos`. This is the pragmatic, cheap way to
remove the calls from the hot path.
@Dream-Master Dream-Master requested a review from a team May 19, 2024 14:28
@Dream-Master Dream-Master merged commit 23f83a5 into GTNewHorizons:master May 19, 2024
2 checks passed
@szuend szuend deleted the skip-add-trace-info branch May 19, 2024 16:18
Dream-Master pushed a commit that referenced this pull request May 20, 2024
`updateEntity` in `LogisticsTileGenericPipe` currently creates a debug
string that goes unused in normal release builds. We can skip allocating
temporary `StringBuilder` instances by checking the DEBUG flag
directly.

Normally we'd use a format string with an additional varargs argument,
but the `add(Super)TraceInformation` methods already use a varargs
parameter to pass nested `Infos`. This is the pragmatic, cheap way to
remove the calls from the hot path.

(cherry picked from commit 23f83a5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants