Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adamgfraser
Copy link
Contributor

We should be able to efficiently copy array backed chunks even after slicing.

right.toArray(n + left.length, dest)
override protected[zio] def toArray[A1 >: A](srcPos: Int, dest: Array[A1], destPos: Int, length: Int): Unit = {
val n = math.max(math.min(math.min(length, left.length - srcPos), dest.length - destPos), 0)
left.toArray(srcPos, dest, destPos, n)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could skip this call completely if srcPos > left.length (the length is needed for the next line anyway)

@jdegoes jdegoes merged commit 31c7a85 into zio:series/2.x Feb 25, 2023
@adamgfraser adamgfraser deleted the toarray branch March 8, 2023 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants