Performance

Laptop with Kotlin code open
Tutorials

Lazy Computation in Kotlin: The sequence Builder and How It Can Save Your Memory

The Hidden Cost of Eager Collections Kotlin’s collection functions — map, filter, flatMap — are a joy to use. But they share one characteristic that can quietly hurt your app: they’re eager. Each call processes the entire source and allocates a brand new intermediate list. Chain three or four of them on a list of […]

, , , , ,
Tutorials

Stop Using System.currentTimeMillis() for Benchmarking: Kotlin’s measureTimedValue and Duration API

The Old Way: Manual Time Measurement If you’ve ever benchmarked a function in Kotlin or Android, you’ve probably written something like this: val start = System.currentTimeMillis() val result = doExpensiveWork() val elapsed = System.currentTimeMillis() – start Log.d(“Perf”, “doExpensiveWork took ${elapsed}ms, result=$result”) It works, but it’s noisy. You need three lines just to time one call,

, , , , ,
Scroll to Top