[ 
https://issues.apache.org/jira/browse/CAMEL-23693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Work on CAMEL-23693 started by Guillaume Nodet.
-----------------------------------------------
> camel-core - Optimize CaseInsensitiveMap hash function for ASCII keys
> ---------------------------------------------------------------------
>
>                 Key: CAMEL-23693
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23693
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.21.0
>
>
> Optimize the CaseInsensitiveMap hash function and eliminate redundant hash 
> computations.
> The initial O(1) hash table implementation (CAMEL-23691) used 
> Character.toLowerCase(Character.toUpperCase(c)) per character in the hash 
> function, which is expensive for the common case of ASCII header names. 
> Additionally, put() computed the hash 3 times (dedup + find + bucket insert) 
> and remove() computed it twice (find + unlink).
> Changes:
> - ASCII fast-path in hash function: simple c += 32 for A-Z instead of full 
> Unicode case fold per character
> - Single-hash put(): compute hash once, reuse for deduplication, find, and 
> bucket insertion
> - Single-hash remove(): inline chain walk with one hash computation
> Benchmark results (18 typical headers, 2M iterations):
> - put/get/containsKey/remove: 33.3M ops/s (was 9.0M, now 1.2x faster than 
> TreeMap)
> - Exchange copy: 1.9M copies/s (was 490K, now 1.1x faster than TreeMap)
> - Get-heavy lookups: 39.8M lookups/s (was 16.9M, now 1.7x faster than TreeMap)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to