Skip to content

Fix class-name filter checks for Unicode and long names - #142

Open
mcculls wants to merge 1 commit into
mainfrom
mcculls/class-name-filter-masks
Open

mcculls wants to merge 1 commit into
mainfrom
mcculls/class-name-filter-masks

Conversation

@mcculls

@mcculls mcculls commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

What Does This Do

Make ClassNameFilter.contains compare the same truncated character and length values that add stores. Names such as example.例 and simple names longer than 256 characters can now match immediately after insertion.

Motivation

Insertion packs the first and last characters and the simple-name length into eight bits each, but lookup previously compared them against full values. This caused avoidable misses for Unicode and long simple names.

Additional Notes

The length mask retains the sign bit to reject a stored start position beyond the queried name's end. Both character mismatches are combined with XOR/OR before masking, reducing the overhead of separate comparisons. Regression tests cover Unicode names, length boundaries, and a shorter hash collision that would otherwise cause an out-of-bounds read.

Validation: ./gradlew :utils:check --no-configuration-cache passed, including formatting, SpotBugs, and tests on Java 8, 11, 17, 21, and 25.

The existing single-threaded benchmark at 65,536 slots measured 242.75 us per corpus pass on main and 243.37 us with this fix. Six balanced comparison rounds on Java 17/ARM64, with 5 seconds of warmup and 10 seconds of measurement per fork, gave a paired difference of +0.25% (95% confidence interval: -0.68% to +1.19%).

Contributor Checklist

  • Added regression tests.
  • Passed utils module checks on all configured Java versions.
  • Benchmarked the affected lookup path against main.

@mcculls
mcculls marked this pull request as ready for review October 17, 2026 16:22
@mcculls
mcculls requested a review from a team as a code owner October 17, 2026 16:22
@mcculls
mcculls requested review from mtoffl01 and removed request for a team October 17, 2026 16:22

This branch has not been deployed

No deployments
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.

1 participant