Skip to content

Commit

Permalink
[finagle-stats] Do not allocate a new IndexedSeq on every metric lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
mbezoyan authored and jenkins committed Jan 25, 2024
1 parent 644094e commit 82e0bdb
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ object MetricBuilder {

val NoDescription: String = "No description provided"

private[this] val EmptyPercentiles = IndexedSeq.empty

/**
* Construct a MethodBuilder.
*
Expand Down Expand Up @@ -105,7 +107,8 @@ object MetricBuilder {
relativeName: Seq[String] = Seq.empty,
processPath: Option[String] = None,
histogramFormat: HistogramFormat = HistogramFormat.Default,
percentiles: IndexedSeq[Double] = IndexedSeq.empty,
percentiles: IndexedSeq[Double] =
EmptyPercentiles, // IndexedSeq.empty creates a new collection on every call
isStandard: Boolean = false,
metricType: MetricType,
): MetricBuilder = {
Expand Down

0 comments on commit 82e0bdb

Please sign in to comment.