From dc6680bdfa11f0f7f578715ab3b66a5633f384e5 Mon Sep 17 00:00:00 2001 From: Mikhail Bezoyan Date: Tue, 3 Sep 2024 14:22:35 +0000 Subject: [PATCH] [finagle-core] Don't make an unnecessary copy of the array with frames 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 --- .../com/twitter/finagle/decoder/LengthFieldFramer.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/finagle-core/src/main/scala/com/twitter/finagle/decoder/LengthFieldFramer.scala b/finagle-core/src/main/scala/com/twitter/finagle/decoder/LengthFieldFramer.scala index 27252cf08f..17a2eb9313 100644 --- a/finagle-core/src/main/scala/com/twitter/finagle/decoder/LengthFieldFramer.scala +++ b/finagle-core/src/main/scala/com/twitter/finagle/decoder/LengthFieldFramer.scala @@ -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 { @@ -150,7 +151,7 @@ private[twitter] class LengthFieldFramer( } accum = accum.slice(frameCursor, accum.length) - frames.toIndexedSeq + frames.asInstanceOf[IndexedSeq[Buf]] } else { NoFrames }