Improve player lookups with inconsistent casing - #428
Merged
Merged
Conversation
Jikoo
enabled auto-merge (squash)
September 13, 2026 17:13
Owner
Author
|
Oh yes, and very exciting, OpenInv's first test case! It's not much, but now I have less of an excuse to not write tests when bugs crop up! The internals still probably aren't worth the bother to test, but the Bukkit API side is rather more manageable. |
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.
Replaces the Symmetrics Jaro-Winkler implementation with my own hand-rolled version of the algorithm modified to value case less for ASCII alphabetic characters.
I didn't look at the Symmetrics implementation until I was done so as to not accidentally copy their work, and then I got concerned about performance because their version was so wildly different (no wonder I didn't understand it before).
Turns out that either they did some wacky things or whatever modifications I did back when I jammed it into the project were really not great. I don't really care to point fingers, it's pretty safe to assume I didn't know what the heck I was doing.
The new version runs in about 60% of the time of the old one. Could definitely speed that up by caching the input codepoint array for the search string, but that's probably not worth the struggle on the SQLite side.
This does not support non-ASCII characters. That could be done, but would likely require that the algorithm effectively run twice - once for raw, once for normalized, and then they could be combined into a weighted average. The normalized search string should also be cached externally.
Closes #427