diff --git a/atlas-jmh/src/main/scala/com/netflix/atlas/webapi/PublishPayloadsBench.scala b/atlas-jmh/src/main/scala/com/netflix/atlas/webapi/PublishPayloadsBench.scala index 8e76a4e33..96b7928eb 100644 --- a/atlas-jmh/src/main/scala/com/netflix/atlas/webapi/PublishPayloadsBench.scala +++ b/atlas-jmh/src/main/scala/com/netflix/atlas/webapi/PublishPayloadsBench.scala @@ -76,6 +76,13 @@ class PublishPayloadsBench { } } + // Skips the ID calculation. + private def decodeBatchDatapoints(data: Array[Byte]): List[Datapoint] = { + Using.resource(Json.newSmileParser(new ByteArrayInputStream(data))) { parser => + PublishPayloads.decodeBatchDatapoints(parser) + } + } + private def encodeBatch(values: List[DatapointTuple]): Array[Byte] = { Streams.byteArray { out => Using.resource(Json.newSmileGenerator(out)) { gen => @@ -126,6 +133,14 @@ class PublishPayloadsBench { } } + @Benchmark + def decodeBatchDatapoints(bh: Blackhole): Unit = { + val consumer = new BlackholePublishConsumer(bh) + decodeBatchDatapoints(encodedBatch).foreach { d => + consumer.consume(null, d.tags, d.timestamp, d.value) + } + } + @Benchmark def decodeCompactBatch(bh: Blackhole): Unit = { val consumer = new BlackholePublishConsumer(bh)