Kotlin Syntactic Sugar in Bytecode: Which Ones Are Actually Free

Kotlin Syntactic Sugar in Bytecode: Which Ones Are Actually Free

I compiled a dozen Kotlin sugars and read the javap output. Three tiers: ?. is a real ifnull jump with zero allocation, inline saves 0.01 B per call while copying the body, string templates hinge on jvmTarget, and lazy’s three modes I could not measure.

2026-11-13 · 7 min · 1461 words · Trevor Wang
Kotlin 2.5 Value Classes Save No Memory, and Destructuring Changes Meaning

Kotlin 2.5 Value Classes Save No Memory, and Destructuring Changes Meaning

Kotlin 2.5.0-RC pushes full value classes, so I read bytecode: javap shows a plain class, no box-impl. In a list it allocates 36.0 B, the same as the data class. The real win is a class file 21% smaller, and default destructuring still silently swaps names.

2026-11-13 · 3 min · 1497 words · Trevor Wang