How to profile and speed up test execution by understanding the overhead introduced by Gradle and IntelliJ IDEA.
I took a test yesterday and it said that I have the reaction time of a 25 year old.
My super speedy brain must be the reason that I find it so irritating to sit and wait for tests to complete. My MacBook Air is apparently 5.5 times faster than its equivalent 10 years ago, but I’m pretty that sure building and running the tests on a medium sized project is much less instant than it was then.
Why are my tests so slow?
In this episode
# Both the test runners are lying
# We can profile a Gradle build
# The IntelliJ runner isn't reporting build time
# Instrumenting the whole build and run
# Speeding up our Gradle build by skipping a task
# Running slow tests first
# It's still all a bit rubbish
There is a playlist of TDD Gilded Rose episodes - youtube.com/playlist?list=PL1ssMPpyqocg2D_8mgIbcnQGxCPI2_fpA
and one for Gradle youtube.com/playlist?list=PL1ssMPpyqochuFygA1ufdt9iMZ17H84D-
The codebase is available on GitHub github.com/dmcg/gilded-rose-tdd
I get lots of questions about the test progress bar. It was written by the inimitable @dmitrykandalov. To use it install his Liveplugin (plugins.jetbrains.com/plugin/7282-liveplugin) and then this gist gist.github.com/dmcg/1f56ac398ef033c6b62c82824a15894b
If you are going to be at KotlinConf 2025, or even just in Copenhagen in May, then you should sign up for the workshop that Nat Pryce and I are running. It’s called Refactoring to Functional Kotlin, and will give you hands-on experience of taking legacy code and safely migrating it to a functional style. Places are limited, so buy now at kotlinconf.com/workhops
If you like this video, you’ll probably like my book Java to Kotlin, A Refactoring Guidebook (java-to-kotlin.dev). It's about far more than just the syntax differences between the languages - it shows how to upgrade your thinking to a more functional style.
Why it's here
1 person recommends this
What people say. Recommended for its practical investigation into why test suites run slowly in IntelliJ and Gradle.
d
u/dmcgin r/Kotlin • Recommends
…nners are lying
# 00:01:36 We can profile a Gradle build
# 00:02:37 The IntelliJ runner isn't reporting build time
# 00:03:28 Instrumenting the whole build and run
# 00:06:00 Speeding up our Gradle build by skipping a task
# 00:09:21 Running slow tests first
# 00:12:44 It's still all a bit rubbish
There is a playlist of TDD Gilded Rose episodes - link to this video
and one for Gradle link to this video
The codebase is available on GitHub https://github.com/dmcg/gilded-rose-tdd
I get lots of questions about the test progress bar. It was written by the inimitable @dmitrykandalov. To use it install his Liveplugin (https://plugins.jetbrains.com/plugin/7282-liveplugin) and then this gist https://gist.github.com/dmc…
…hat I’m obsessed with the details of how long our tests are actually taking to run. I won’t speak for all developers, but I at least can be a little, erm compulsive when I get the bit between my teeth.
So when I suspected that IntelliJ was just plain lying to me about how fast tests are running, I had to see if my suspicions were true. Last week (link to this video we saw that there is a lot of time between invoking the action and the tests actually running. This week we’ll see that the reported duration of individual tests, and the suites that they sit in, appear to be wrong too.
In this episode
* 00:00:38 The story so far
* 00:01:18 Crank up the AI
* 00:01:40 AI Assistant bug
* 00:04:07 Oooh test…