Jackie-Jiang opened a new pull request, #9278: URL: https://github.com/apache/pinot/pull/9278
Avoid using `ByteArrayOutputStream` which will potentially copy bytes multiple times (during expand and final `toByteArray()`). Pre-calculate the buffer size required, and then create the buffer only once. ## Before optimization BenchmarkObjectSerDe.bytesSet avgt 5 557.718 ± 31.501 ms/op BenchmarkObjectSerDe.stringList avgt 5 1089.643 ± 30.302 ms/op BenchmarkObjectSerDe.stringSet avgt 5 1061.030 ± 98.827 ms/op BenchmarkObjectSerDe.stringToStringMap avgt 5 1947.736 ± 29.011 ms/op ## After optimization BenchmarkObjectSerDe.bytesSet avgt 5 360.085 ± 10.518 ms/op BenchmarkObjectSerDe.stringList avgt 5 911.377 ± 35.301 ms/op BenchmarkObjectSerDe.stringSet avgt 5 920.723 ± 29.300 ms/op BenchmarkObjectSerDe.stringToStringMap avgt 5 1699.881 ± 165.362 ms/op -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org