GWphua commented on PR #18457: URL: https://github.com/apache/druid/pull/18457#issuecomment-3241092753
@kfaraz @FrankChen021 I did a benchmark for 50,000 accesses of `readValue()`, and the benchmark favours using `JavaType` over `TypeReference`. Furthermore, after referencing [Jackson best practices](https://github.com/FasterXML/jackson-docs/wiki/Presentation:-Jackson-Performance), I have tried to benchmark for `ObjectReader`, and the performance does better. I think we can consider using `ObjectReader` in favour of `ObjectMapper` in the future. ``` # JMH version: 1.21 # VM version: JDK 17.0.12, Java HotSpot(TM) 64-Bit Server VM, 17.0.12+8-LTS-286 # VM invoker: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/java # VM options: <none> # Warmup: 2 iterations, 10 s each # Measurement: 3 iterations, 10 s each # Timeout: 10 min per iteration # Threads: 1 thread, will synchronize iterations # Benchmark mode: Average time, time/op Benchmark Mode Cnt Score Error Units ChangeRequestDeserBenchmark.cached_javaType_50k_calls avgt 3 11157.673 ± 566.225 us/op ChangeRequestDeserBenchmark.cached_objectReader_50k_calls avgt 3 10599.758 ± 338.292 us/op ChangeRequestDeserBenchmark.typeReference_50k_calls avgt 3 11723.273 ± 1115.112 us/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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
