Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atlas JMH: Quantify skipping decoding of the time series ID #1610

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import scala.util.Using
* ```
* Benchmark Mode Cnt Score Error Units
* decodeBatch thrpt 5 23.787 ± 1.148 ops/s
* decodeBatchDatapoints thrpt 5 129.900 ± 3.767 ops/s
* decodeCompactBatch thrpt 5 173.148 ± 1.835 ops/s
* decodeList thrpt 5 25.277 ± 0.254 ops/s
* encodeBatch thrpt 5 179.382 ± 39.696 ops/s
Expand Down Expand Up @@ -76,6 +77,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 =>
Expand Down Expand Up @@ -126,6 +134,14 @@ class PublishPayloadsBench {
}
}

@Benchmark
def decodeBatchDatapoints(bh: Blackhole): Unit = {
manolama marked this conversation as resolved.
Show resolved Hide resolved
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)
Expand Down
Loading