In the source code, Map<Object, String> names = new HashMap<>(beans.size());, beans.size() actually equal 0. This problem will cause the hashMap to resize multiple times in subsequent put operations. This operation of resize is expensive when the expected size is large. So, I think we can set a suitable initialCapacity value to names of HashMap type, doing this prevents resize.

Comment From: jhoeller

On review, I've applied a more general revision: avoiding unnecessary trace logging in ProxyFactoryBean, allowing us to skip that beans map completely and therefore never having to compute its capacity to begin with. Thanks for pointing this out, and thanks for the pull request in any case!