# Benchmarking the Performance of Java and Kotlin Reflection

DevFeed: [Benchmarking the Performance of Java and Kotlin Reflection](<https://devfeed.tech/articles/is-reflection-slowing-down-your-code-39220.md>)

Original publisher: [Read original article](<https://kt.academy/article/benchmark-reflection>)

Published: 2024-12-16T00:00:00Z

Content type: article

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [Java](<https://devfeed.tech/topics/java.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [kotlin compiler](<https://devfeed.tech/topics/kotlin-compiler.md>)

Tags: [benchmark](<https://devfeed.tech/tags/benchmark.md>), [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-compiler](<https://devfeed.tech/tags/kotlin-compiler.md>), [logging](<https://devfeed.tech/tags/logging.md>), [performance](<https://devfeed.tech/tags/performance.md>), [synchronization](<https://devfeed.tech/tags/synchronization.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

## AI overview

This article benchmarks regular function calls, Java reflection, and Kotlin reflection. It finds that reflection is much slower than regular calls, Java reflection is slightly faster than Kotlin reflection in the measured test, and reflection has a comparable cost to synchronization while being faster than logging.

## Source excerpt

Let's benchmark reflection and see how it affects the performance of your code.