Skip to content

Commit

Permalink
[finagle-core] Don't make an unnecessary copy of the array with frame…
Browse files Browse the repository at this point in the history
…s in LengthFieldFramer

Problem:
We unnecessarily copy the array with extracted frames into an indexed seq.

Solution:
Don't copy

Differential Revision: https://phabricator.twitter.biz/D1164516
  • Loading branch information
mbezoyan authored and jenkins committed Sep 3, 2024
1 parent be778a3 commit dc6680b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.twitter.finagle.decoder

import com.twitter.io.{Buf, ByteReader}
import com.twitter.io.Buf
import com.twitter.io.ByteReader
import scala.collection.mutable.ArrayBuffer

private[twitter] object LengthFieldFramer {
Expand Down Expand Up @@ -150,7 +151,7 @@ private[twitter] class LengthFieldFramer(
}

accum = accum.slice(frameCursor, accum.length)
frames.toIndexedSeq
frames.asInstanceOf[IndexedSeq[Buf]]
} else {
NoFrames
}
Expand Down

0 comments on commit dc6680b

Please sign in to comment.