Skip to content

Avoid boxed redirect status lookup - #2260

Closed
pavel-ptashyts wants to merge 1 commit into
AsyncHttpClient:mainfrom
maygemdev:perf/redirect-status-check
Closed

pavel-ptashyts wants to merge 1 commit into
AsyncHttpClient:mainfrom
maygemdev:perf/redirect-status-check

Conversation

@pavel-ptashyts

Copy link
Copy Markdown
Contributor

Summary

  • Replace the redirect status Set<Integer> lookup with a primitive status-code helper.
  • Remove Redirect30xInterceptor.REDIRECT_STATUSES.
  • Use the helper from the response interceptor hot path before redirect handling.
  • Add unit coverage for redirect and non-redirect status codes.

Motivation

The response interceptor checks redirect status codes for every response. The previous Set<Integer> lookup boxed each response status code before lookup. A primitive comparison helper keeps the redirect behavior unchanged while avoiding that allocation.

Validation

  • /opt/maven/bin/mvn -pl client -DskipTests compile
  • /opt/maven/bin/mvn -pl client -Dtest=Redirect30xInterceptorTest,Relative302Test test

Replace the redirect status Set lookup with a primitive status-code helper in the response interceptor hot path. This removes the Redirect30xInterceptor.REDIRECT_STATUSES set and avoids boxing response codes before redirect handling.

Add a unit test for the exact redirect and non-redirect status codes covered by the helper.

Verified with:\n- /opt/maven/bin/mvn -pl client -DskipTests compile\n- /opt/maven/bin/mvn -pl client -Dtest=Redirect30xInterceptorTest,Relative302Test test
@pavel-ptashyts

Copy link
Copy Markdown
Contributor Author

Closing because this performance change will not be pursued.

@pavel-ptashyts
pavel-ptashyts deleted the perf/redirect-status-check branch July 19, 2026 16:27
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.

1 participant