RFR: 8314199: Initial size PBEKeyFactory#validTypes is not up-to-date

Jamil Nimeh jnimeh at openjdk.org
Mon Oct 9 20:16:57 UTC 2023


On Mon, 9 Oct 2023 19:19:49 GMT, Kevin Driver <kdriver at openjdk.org> wrote:

>> I wondered about an approach like this. I'll push another commit with these changes.
>
> Do you think we'll lose performance in a meaningful way? One of the guarantees of HashSet is constant-time operations. 
> 
> There is no such guarantee for Set. The number of members is probably small enough, relatively speaking, to not affect things much at creation time (and we only do this once); however, lookup time (in `engineGetKeySpec` and `engineTranslateKey`) might take a small hit if these methods are called repeatedly. 
> 
> Let me know whether you think this is a valid concern. Thanks!

I think there could be sight timing variations between `HashSet` and whatever Set implementation is returned by `Set.of()` but creation only happens once as you stated, and iterations over 20-ish elements just seems like the variance would be negligible in any real-world use cases.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16103#discussion_r1350752518



More information about the security-dev mailing list