Repository navigation
Index morphology tokens without changing encoding behavior - #6
Merged
Merged
Conversation
…measured benchmarks
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
Replace the per-call enum-array clone and linear scan in
MorphologyTag.fromString()with a private immutable token map. Preserve exact matching, first-match behavior, null handling, and error messages.Changes
Validation and independent review
The source baseline is
ba2dd3e272ad181d84e56e4726af7aa03d3c65f0. Baseline tests and measurements were committed before production changes.All four compatibility tests pass against both the original artifact and candidate. They cover all 71 enum ordinals and tokens, invalid/null diagnostics, all 256 byte values, all 65,536 UTF-16 encoding inputs, ё folding, and first-match part-of-speech selection.
A separate reviewer found no production/API regression or benchmark dead-code-elimination issue. Generated JMH loops consume the results. Missing or unrelated baseline archives now fail explicitly rather than silently loading candidate classes. No dictionary, encoding rule, enum ordinal, or public method signature changes.
Performance
JMH 1.37, three forks, three 1-second warmups and five 1-second measurements per fork, fixed 1 GiB heap. Both implementations use the same harness and JDK. Means
±99.9% confidence intervals:Raw results and reproduction instructions are in docs/compatibility.md.
Limitations
The map adds a small persistent 71-entry structure. Reused-token results benefit from cached hashes; the fresh-token workload includes token construction and measures uncached input. Neither is an end-to-end compiler speedup.
aot-compilerstill pins the older2021.10.26API and does not automatically receive this change.