RFR: 8215995: Add specialized toArray methods to immutable collections
claes.redestad at oracle.com
Wed Jan 2 20:17:06 UTC 2019
On 2019-01-02 20:55, Martin Buchholz wrote:
> Which bounds check?
> On the second leg, you know you'll never hit the end of the array, so
> you can elide the check. But hotspot may not be so clever and may
> re-insert it, in a slightly more expensive variant that has actual
> exception throwing code.
I see what you mean now and perhaps that'd eliminate a branch per
element if we did toArray inline rather than use an iterator. Might be
a reasonable optimization that can stand on it's own in a follow-up.
More information about the core-libs-dev