david-mollitor-db opened a new pull request, #58285: URL: https://github.com/apache/spark/pull/58285
### What changes were proposed in this pull request? `ArrayWrappers.ComparableByteArray.compareTo` (in `common/kvstore`, used to order `byte[]` keys in the KVStore that backs the Spark status/UI store) implements a hand-written scalar loop that compares bytes one at a time. This replaces that loop with `java.util.Arrays.compare(byte[], byte[])`. ### Why are the changes needed? `Arrays.compare` performs the identical comparison — signed, lexicographic, comparing the common prefix first and ordering the shorter array first on a tie — but it is a HotSpot intrinsic backed by a vectorized (SIMD) mismatch scan, so it is faster while preserving the exact ordering. It is also simpler than the hand-written loop. **Semantics are unchanged.** The existing byte comparison is signed (`array[i] - other.array[i]` promotes each `byte` to a sign-extended `int`), which matches `Arrays.compare`'s `Byte.compare` semantics; the single-element byte difference cannot overflow, so behavior is unchanged. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Covered by the existing `ArrayWrappersSuite.testGenericArrayKey`, which asserts the `compareTo` ordering for `byte[]` keys. No behavior change, so no new tests were added. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 4.8) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
