gnodet opened a new pull request, #23779: URL: https://github.com/apache/camel/pull/23779
[CAMEL-23693](https://issues.apache.org/jira/browse/CAMEL-23693) ## Summary Optimize the `CaseInsensitiveMap` hash function and eliminate redundant hash computations introduced in CAMEL-23691. - **ASCII fast-path in hash**: `c += 32` for `A-Z` instead of `Character.toLowerCase(Character.toUpperCase(c))` per character. Full Unicode two-step fold only for non-ASCII (`c >= 128`) - **Single-hash `put()`**: compute hash once, reuse for deduplication lookup, find, and bucket insertion (was 3 separate hash computations) - **Single-hash `remove()`**: inline chain walk with one hash computation (was 2) ### Benchmark (18 typical headers, 2M iterations) | Scenario | Before | After | vs TreeMap (old impl) | |---|---|---|---| | put/get/containsKey/remove | 9.0M ops/s | **33.3M ops/s** | **1.2x faster** | | Exchange copy (create+populate+copy) | 490K copies/s | **1.9M copies/s** | **1.1x faster** | | Get-heavy (10 lookups/iter) | 16.9M lookups/s | **39.8M lookups/s** | **1.7x faster** | ## Test plan - [x] `CaseInsensitiveMapTest` — 32 tests pass - [x] `DefaultMessageHeaderTest` — 38 tests pass -- 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]
