Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
By caching default constructors used in java.security.Provider::newInstanceUtil in a ClassValue, we can reduce the overhead of allocating instances in a variety of places, e.g., MessageDigest::getInstance, without compromising thread-safety or security. See: https://cl4es.github.io/2021/01/04/Investigating-MD5-Overheads.html#reflection-overheads for context. Doing this reduces memory allocations made by repeated calls to MessageDigest.getInstance("MD5") by 120 bytes/op, and I expect similar improvements would show up in more places.
|