Hello, why are scratches so slow nowadays? Every ...
# intellij
l
Hello, why are scratches so slow nowadays? Every small change takes like 8 seconds to run, while I barely have any code. Super frustrating.
➕ 1
This shows up for way too long. I have 8 one-liner functions, and 3 lines of code that use
kotlin.time
that I want to play with and fix using scratches as a small playground.
Copy code
import kotlin.time.Duration
import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
import kotlin.time.TimeSource

fun Duration.timeOffFromWholeDays(): Duration = this - this.inWholeDays.days
fun Duration.timeOffFromWholeHours(): Duration = this - this.inWholeHours.hours
fun Duration.timeOffFromWholeMinutes(): Duration = this - this.inWholeMinutes.minutes
fun Duration.timeOffFromWholeSeconds(): Duration = this - this.inWholeSeconds.seconds

fun Duration.timeToNextDay(): Duration = 1.days - timeOffFromWholeDays()
fun Duration.timeToNextHour(): Duration = 1.hours - timeOffFromWholeHours()
fun Duration.timeToNextMinute(): Duration = 1.minutes - timeOffFromWholeMinutes()
fun Duration.timeToNextSecond(): Duration = 1.seconds - timeOffFromWholeSeconds()

val in30s = TimeSource.Monotonic.markNow() + 40.seconds

in30s.elapsedNow().toString()
in30s.elapsedNow().timeOffFromWholeSeconds().toString()
I’m using Android Studio Rabbit 2 | 2026.2.2 Build #AI-262.10968.63.2622.16730706, built on October 27, 2026
h
Scratches have never really worked for me since the K2 switch 🤷‍♂️
n
play.kotlinlang.org is faster than scratches, but it is frustrating to not have everything in the IDE