Cache ServerHttpRequest::getMethod in AbstractServerHttpRequest by yuzawa-san · Pull Request #30139 · spring-projects/spring-framework (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@yuzawa-san

ServerHttpRequest.method() is called twice on each HttpMethodPredicate and within CorsUtils.isPreFlightRequest(). Each call has to do a roundtrip all the way into netty and it does a bunch of String hashing to resolve the proper Spring HttpMethod. I moved this work to be done once upon request construction since the field read is cheaper.

@yuzawa-san

@poutsma

Thanks for leaving a PR.

It seems only fair that we introduce the same enhancement for the other ServerHttpRequest implementations, so I moved your changes to AbstractServerHttpRequest.

@poutsma poutsma changed the titleCache ServerHttpRequest.method() for Reactor Netty's Requests Cache ServerHttpRequest::method in AbstractServerHttpRequest

Mar 21, 2023

@poutsma poutsma changed the titleCache ServerHttpRequest::method in AbstractServerHttpRequest Cache ServerHttpRequest::getMethod in AbstractServerHttpRequest

Mar 21, 2023

poutsma added a commit that referenced this pull request

Mar 21, 2023

@poutsma

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

Labels