On Wed, 4 Jan 2023 14:41:20 GMT, Viktor Klang <d...@openjdk.org> wrote:

> Currently Set.copyOf allocates both a HashSet and a new empty array when the 
> input collection is empty.
> 
> This patch avoids allocating anything for the case where the parameter 
> collection's isEmpty returns true.

Curious: how bad was that "needless allocation" that it was required to be 
optimized away?

-------------

PR: https://git.openjdk.org/jdk/pull/11847

Reply via email to