`by lazy` computes a value on first access and then caches it. It’s useful for expensive initialization you may not need, and it can be thread-safe depending on the chosen mode.
val config by lazy { loadConfig() }
fun loadConfig(): String = "ok"
Advanced answer
Deep dive
Expanding on the short answer — what usually matters in practice:
Context (tags): lazy, delegates, initialization
JVM: memory (heap/stack), GC, and what drives latency.
Contracts: equals/hashCode/toString, mutability and consequences.