<commit_before>package org.pico.statsd.syntax.event

import org.pico.disposal.{Auto, Disposable}
import org.pico.event.Bus
import org.pico.statsd._

import scala.concurrent.duration.Deadline

object MetricPerformanceMain {
  implicit val statsDClientDisposable = Disposable[StatsdClient](_.stop())

  case class Topic(name: String) extends AnyVal
  case class Record(topic: Topic, partition: Long, offset: Long)

  implicit def consumedRecordMetric[A]: Metric[Record] =
    Metric[Record](
      r => List(IntegralGauge("offset", r.offset), Counter("record.count", 1)),
      x => List(s"topic:${x.topic.name}", s"partition:${x.partition}"))

  def main(args: Array[String]): Unit = {
    val record = Record(Topic("topic"), 1L, 1000L)

    for (statsd <- Auto(new NonBlockingStatsdClient("attackstream-dedup", "localhost", 8125))) {
      implicit val statsdInstance = statsd

      val bus = Bus[Record]

      bus.withMetrics("consumer.record.count", None)

      val before = Deadline.now

      for (i <- 0 until 10000000) {
        bus.publish(record)
      }

      val after = Deadline.now

      println(after - before)
    }
  }
}
<commit_msg>MAYH-3743 Avoid string interpolation for performance<commit_after>package org.pico.statsd.syntax.event

import org.pico.disposal.{Auto, Disposable}
import org.pico.event.Bus
import org.pico.statsd._

import scala.concurrent.duration.Deadline

object MetricPerformanceMain {
  implicit val statsDClientDisposable = Disposable[StatsdClient](_.stop())

  case class Topic(name: String) extends AnyVal
  case class Record(topic: Topic, partition: Long, offset: Long)

  implicit def consumedRecordMetric[A]: Metric[Record] =
    Metric[Record](
      r => List(IntegralGauge("offset", r.offset), Counter("record.count", 1)),
      x => List("topic:" + x.topic.name, "partition:" + x.partition))

  def main(args: Array[String]): Unit = {
    val record = Record(Topic("topic"), 1L, 1000L)

    for (statsd <- Auto(new NonBlockingStatsdClient("attackstream-dedup", "localhost", 8125))) {
      implicit val statsdInstance = statsd

      val bus = Bus[Record]

      bus.withMetrics("consumer.record.count", None)

      val before = Deadline.now

      for (i <- 0 until 10000000) {
        bus.publish(record)
      }

      val after = Deadline.now

      println(after - before)
    }
  }
}

{'fraction_non_alphanumeric': 0.1293213828425096, 'fraction_numerical': 0.01792573623559539, 'mean_word_length': 3.697394789579158, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5015917', 'n_tokens_mistral': 804, 'n_tokens_neox': 726, 'n_words': 171}