Skip to content

Optimize HTTP client performance: eliminate redundant header...#1069

Merged
jenschude merged 1 commit into
commercetools:mainfrom
peniakoff:copilot/source-code-analyzing-and-optimizing
May 28, 2026
Merged

Optimize HTTP client performance: eliminate redundant header...#1069
jenschude merged 1 commit into
commercetools:mainfrom
peniakoff:copilot/source-code-analyzing-and-optimizing

Conversation

@peniakoff

Copy link
Copy Markdown
Contributor

...iterations and unnecessary allocations

  • Replace toMultimap() + stream + flatMap + collect with direct header iteration in OkHttp3/4/5 clients

  • Replace stream().anyMatch() + getFirst() double iteration with single getFirst() null check in all HTTP clients

  • Replace groupingBy + flatMap pattern in Apache HTTP client with direct array iteration

  • Fix toArray(new CompletableFuture[size]) to toArray(new CompletableFuture[0]) in CompletableFutureUtils

  • Replace String.format with concatenation in BaseAuthTokenSupplier logging

  • Add explicit UTF-8 charset to new String(byte[]) in BaseAuthTokenSupplier

  • Changeset added

Features

Fixes

Breaking changes

…ns and unnecessary allocations

- Replace toMultimap() + stream + flatMap + collect with direct header iteration in OkHttp3/4/5 clients
- Replace stream().anyMatch() + getFirst() double iteration with single getFirst() null check in all HTTP clients
- Replace groupingBy + flatMap pattern in Apache HTTP client with direct array iteration
- Fix toArray(new CompletableFuture[size]) to toArray(new CompletableFuture[0]) in CompletableFutureUtils
- Replace String.format with concatenation in BaseAuthTokenSupplier logging
- Add explicit UTF-8 charset to new String(byte[]) in BaseAuthTokenSupplier
Copilot AI review requested due to automatic review settings May 27, 2026 13:32
@peniakoff peniakoff requested a review from a team as a code owner May 27, 2026 13:32
@jenschude

Copy link
Copy Markdown
Contributor

That's a nice list of findings.

@jenschude jenschude merged commit bc02ab7 into commercetools:main May 28, 2026
7 of 10 checks passed
@peniakoff peniakoff deleted the copilot/source-code-analyzing-and-optimizing branch May 28, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants