RFR: 8215995: Add specialized toArray methods to immutable collections
Claes Redestad
claes.redestad at oracle.com
Tue Jan 8 09:52:26 UTC 2019
On 2019-01-08 03:44, Stuart Marks wrote:
>> This is one of Stuart's designs
>
> Trying to blame it all on me, aren't you? :-)
Yes: you are being too nice! :-)
>
> Overall the changes look good.
Thanks!
>
> I can't really speak to how to improve the loops in certain
> circumstances (the "tricky circular array traversal code from
> ArrayDeque" as Martin puts it). But I observe that moving the
> randomization to iteration has started to increase the complexity of the
> code. I understand why we did this, but it's starting to look like we
> might want to refactor the various loops into a single internal
> "iterator" to avoid duplicating it all over the place. Perhaps for a
> future enhancement.
Right, one generic loop method which accepts one of a few statically
defined Functions might cut it, but it would need to be implemented with
care not to regress anything and might not significantly reduce
complexity until we add a few more specializations.
>
> I observe that the serialized forms aren't randomized. When the storage
> order was randomized, the serial form was also randomized. But now that
> randomization is done during iteration, the serialized forms are fixed.
> Hmmm. Not sure what I think about that.
Doesn't it mean we're now actually better at randomizing iteration order
on a run-to-run basis, whereas if we just picked up and went with a
serialized storage we'd retain the iteration order you'd get in the old
VM instance?
Thanks!
/Claes
More information about the core-libs-dev
mailing list