perf(core): specialize string fingerprint fields and inline separators#99
Closed
Arbousier1 wants to merge 1 commit into
Closed
perf(core): specialize string fingerprint fields and inline separators#99Arbousier1 wants to merge 1 commit into
Arbousier1 wants to merge 1 commit into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Add a field(String) overload so the hot fingerprint path appends string fields directly via StringBuilder.append(String) instead of routing through Objects.toString in the field(Object) overload. Replace the Objects.toString(value, "") call with an explicit null check to avoid the wrapper allocation, and inline appendFieldSeparator/finishField so each field(...) overload emits the separator and flag update in the same frame. Behavior is unchanged: null fields still append nothing, non-null fields still append toString(), and raw/entrySeparator keep their existing semantics.
Arbousier1
force-pushed
the
perf/delimited-fingerprint-string-overload
branch
from
July 18, 2026 14:09
7fc0023 to
df2c1f9
Compare
Collaborator
Author
|
Closing per the refreshed performance gate. The candidate was replayed onto current Evidence: https://github.com/EllanServer/MahjongEngine/actions/runs/29647578878 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Optimize
DelimitedFingerprintBuilderto reduce allocation and method dispatch on the hot fingerprint path.Changes
field(String)overload so string fields bypassObjects.toStringand go directly toStringBuilder.append(String)Objects.toString(value, "")infield(Object)with an explicit null check — null still appends nothing, non-null still appendstoString()appendFieldSeparator()/finishField()into eachfield(...)overload to eliminate private helper callsimport java.util.ObjectsBehavior equivalence
All existing semantics are preserved:
field((Object) null)still appends an empty string (no-op)field("literal")now resolves tofield(String)— same output, shorter pathraw(Object)andentrySeparator()are unchangedVerification
Target the
infraperformance profile (DelimitedFingerprintBuilderBenchmark.buildRepresentativeFingerprint).