I just noticed looking at profiles of some reactor based benchmarks we run to measure Datadog tracer overhead that HttpStatus.resolve allocates an HttpStatus[] once per invocation, so once per response. In a very modest throughput benchmark (~600rps) this is allocating 1MB/s just to resolve the integer status code to the HttpStatus enum value.

I tracked the spring framework code down here.
This could be fixed by caching HttpStatus.values() in an array, which could be iterated over as many times as one likes without any further allocation.
I just noticed looking at profiles of some reactor based benchmarks we run to measure Datadog tracer overhead that

HttpStatus.resolveallocates anHttpStatus[]once per invocation, so once per response. In a very modest throughput benchmark (~600rps) this is allocating 1MB/s just to resolve the integer status code to theHttpStatusenum value.I tracked the spring framework code down here.
This could be fixed by caching
HttpStatus.values()in an array, which could be iterated over as many times as one likes without any further allocation.