arturobernalg opened a new pull request, #707: URL: https://github.com/apache/httpcomponents-core/pull/707
`MessageSupport` accepts `List` instances but currently uses the same traversal strategy regardless of the underlying list implementation. This change uses indexed access for `RandomAccess` lists and sequential iteration otherwise, avoiding repeated traversal for lists such as `LinkedList` while preserving the existing fast path for `ArrayList`. JMH results: | Benchmark | List | Entries | Current | Proposed | |---|---|---:|---:|---:| | `formatTokens` | `ArrayList` | 256 | 1018.728 ns/op | 1030.194 ns/op | | `formatTokens` | `LinkedList` | 256 | 12376.211 ns/op | 1132.492 ns/op | | `formatElements` | `ArrayList` | 256 | 13267.483 ns/op | 11482.600 ns/op | | `formatElements` | `LinkedList` | 256 | 36706.158 ns/op | 11269.578 ns/op | The change is limited to list traversal in `formatTokens`, `formatElements`, and `formatParameters`. -- 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]
