> On Mar 1, 2018, at 6:12 AM, Jim Laskey <james.las...@oracle.com> wrote:
> 
> Peter,
> 
> Very reasonable and worth considering. The main reason the power of 2 copy 
> works well is that the source is (almost) always cached.
> 

That was my thinking too, the current approach is fine for anticipated string 
sizes and repeats. 

We could consider more optimal and general cache friendly approaches but the 
API cost is likely higher than the benefit e.g. if we add a method to Arrays 
then 8 + 9 others (all primitives + ref and offset accepting methods) tend to 
come along for the ride.

Paul.

> I thought about this a bit at the beginning and wondered about introducing 
> Arrays.fill(T[] dst, T[] src) where dst is filled repeatedly from src. This 
> can then become an intrinsic and “do the right thing” based on hardware. 
> String::repeat can be adapted later. I didn’t pursue because I lacked other 
> use cases.
> 
> File a performance against the implementation (once checked in) and we can 
> see what the performance team thinks.
> 

> Cheers,
> 
> — Jim

Reply via email to