spring-projects/spring-boot

Remove preinitialisation of Charset.availableCharsets() as StringHttpMessageConverter now uses it lazily

dsyer opened this issue · 2 comments

dsyer commented

I think BackgroundPreinitializer probably initializes Charset.availableCharsets() to avoid it happening in StringHttpMessageConverter. The internals of StringHttpMessageConverter changed in Spring 5 so that Charset.availableCharsets() is called lazily, so we probably don't have to pay this cost on startup in Spring boot 2.0, even in a background thread. It causes quite a bit of activity including GC pressure.

For reference, the improvement in Spring Framework has been done in SPR-15502, and the Spring Boot change in #11570.

Tentatively scheduling this for 2.0.x.

dsyer commented

So if we fix this it doesn't need to be backported, I guess.