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

Skip to content

Conversation

@iravid
Copy link
Member

@iravid iravid commented Sep 25, 2019

I think we had to keep some things in lazy val or def before because of specialization.

I took a quick flamegraph of StreamChunkSpec and Chunk.Concat is a big hotspot. Making things a bit more eager lessens that.

override def toArray[A1 >: A](implicit tag: ClassTag[A1]): Array[A1] = array.asInstanceOf[Array[A1]]

override def length: Int = array.length
override val length: Int = array.length
Copy link
Member

Choose a reason for hiding this comment

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

Another thing you can do: anytime length is referenced, instead put it into a local val. This way it won't go through invokevirtual like all (non-private[this]) val access does.

Copy link
Member

@jdegoes jdegoes left a comment

Choose a reason for hiding this comment

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

Looks great, I trust you on the benchmarks! 😄

@jdegoes jdegoes merged commit 6460c05 into zio:master Sep 26, 2019
Twizty pushed a commit to Twizty/zio that referenced this pull request Nov 13, 2019
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.

2 participants