trivial patch to reduce allocations in nio open* methods

Remi Forax forax at univ-mlv.fr
Tue Mar 6 18:16:01 UTC 2018


Hi Alan,
as i said, the issue is that the static factories of Set does not allow duplicate values while the current spec for FileChannel.open() etc, allow duplicate flags.

Rémi

----- Mail original -----
> De: "Alan Bateman" <Alan.Bateman at oracle.com>
> À: "Michael Skells" <mike.skells1 at gmail.com>, "Brian Burkhalter" <brian.burkhalter at oracle.com>
> Cc: "nio-dev" <nio-dev at openjdk.java.net>
> Envoyé: Mardi 6 Mars 2018 18:40:30
> Objet: Re: trivial patch to reduce allocations in nio open* methods

> 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