trivial patch to reduce allocations in nio open* methods

Alan Bateman Alan.Bateman at oracle.com
Tue Mar 6 17:40:30 UTC 2018


On 06/03/2018 08:17, Michael Skells wrote:
> Hi,
> below is a trivial patch to reduce allocation on the file open call 
> path, when no OpenOption is specified( which is a common case in my 
> test code at least)
>
> There is some duplication of empty set  handling, but I could not see 
> a suitable utility class to provide this and didnt want to create a 
> public method
I think we should start by changing the methods that take varargs so 
that they use the static factory methods for immutable collections, e.g. 
Set.of(options). That would be a good cleanup before seeing it's wroth 
trying to do more for the zero options case.

-Alan


More information about the nio-dev mailing list