Fragmented - AI Developer Podcast · Kaushik Gopal, Iury Souza

254 - 8× faster 5× memory savings with Dan Rusu’s Immutable Arrays

·49 min·3 clips
Dan says object wrappers in JVM lists create a 5× memory hit, or 8× without pointer compression.
1. Fragmented - AI Developer Podcast episode 254 focuses on Dan Rusu’s Immutable Arrays for Kotlin performance and memory use. 2. Kaushik hosts the episode, and Dan Rusu is the guest because he built Immutable Arrays and works on backend Kotlin systems. 3. The episode asks whether Kotlin code can keep list-like APIs while avoiding autoboxing overhead and ArrayList memory costs. 4. Kaushik says Immutable Arrays can offer a 2× to 8× speed boost and about 5× memory savings. 5. Dan says he started looking into Kotlin in 2017 after Google announced it. 6. Dan says he compiled about 50 defect categories from Java that would not compile in Kotlin. 7. Dan says he helped drive Kotlin adoption at Oracle over a nine-month effort. 8. Dan says Kotlin lists are read-only at the interface level, but they are backed by ArrayLists and can still be mutated by casting. 9. Dan says Java and Kotlin arrays can store primitive types directly, while lists generally store objects. 10. Dan says generic lists force boxing, so integers, booleans, and floats are stored through wrapper objects. 11. Dan says JVM object headers are about 12 or 16 bytes, with padding that raises memory cost for wrapper-based storage. 12. Dan says the memory impact is about 5× with pointer compression and 8× without it for floats and integers. 13. Dan says boolean wrappers can reach a 32× memory impact depending on how they are constructed. 14. Dan says operations like takeWhile can precompute the cutoff and copy directly into a result array instead of growing an ArrayList. 15. Dan says even map on ArrayList still checks capacity on every append, while Immutable Arrays skip that work. 16. Dan says Immutable Arrays use overload resolution by lambda return type to choose primitive specializations automatically. 17. Dan says the library is built as inline classes that wrap arrays, and Kotlin compiles the wrapper away. 18. Dan says the API is designed to feel like List, with toList for copying and asList for a zero-copy wrapper. 19. Listeners who build Kotlin performance-sensitive backend or Android code will get the most value. 20. Listeners who only need a high-level Kotlin overview may skip the benchmark details.

As heard by us

A focused Kotlin collections discussion that turns performance claims into a practical mental model.

Kaushik keeps the episode anchored in a practical Kotlin question: whether lists can quietly eat up speed and memory. With Dan Rusu in the mix, the discussion gets into autoboxing, immutability, and Immutable Arrays as a way to skip auto-growing and repeated capacity checks when…

Read the full review in PlayNext →

Why you'd press play

You want to understand why Immutable Arrays claims a 2 to 8x speed boost for Kotlin lists, and what that benchmark story is really measuring.

Read the full recommendation in PlayNext →
Listen to the show on