# High CPU load in IDE when making any code change

**URL:** <https://discuss.kotlinlang.org/t/high-cpu-load-in-ide-when-making-any-code-change/769>\
**Category:** Uncategorized\
**Created:** [July 24, 2013, 2:29pm UTC](https://discuss.kotlinlang.org/t/high-cpu-load-in-ide-when-making-any-code-change/769 "2013-07-24T14:29:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jugglingcats](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jugglingcats](https://discuss.kotlinlang.org/u/jugglingcats)\
**Post date:** [July 24, 2013, 2:29pm UTC](https://discuss.kotlinlang.org/t/high-cpu-load-in-ide-when-making-any-code-change/769/1 "2013-07-24T14:29:21Z")

</div>

Hi, I have a problem in my project where any change to a Kotlin file causes high CPU load for 30 seconds or so (25% load on my four core machine so looks like idea.exe is maxing out one core).

This is only a problem on my laptop - on my home machine things are working fine - for the same project. It’s only a small project with a handful of classes.

I tried deleting the project and re-creating from github but it didn’t help, so perhaps it’s something in my idea setup.

Make is also very slow - 45 seconds (Core i7 / 8Gb). I have another more complex project that compiles in under 10 seconds on the same machine.

If someone can help diagnose the issue I’ll be happy to create a ticket once I can put some more concrete info against it!

Thanks, Alfie.

---

<div class="post-metadata">

**Author:** ![jugglingcats](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jugglingcats](https://discuss.kotlinlang.org/u/jugglingcats)\
**Post date:** [July 24, 2013, 2:55pm UTC](https://discuss.kotlinlang.org/t/high-cpu-load-in-ide-when-making-any-code-change/769/2 "2013-07-24T14:55:55Z")

</div>

I will re-check performance on my home machine, but the slow down seems to be related to heavy use of a groovy style builder.

Below is the source for the offending file. If I comment most of the nested function calls (the main states.forEach on line 80), I can get the compilation back down close to 10 seconds…

[https://github.com/jugglingcats/tjbpm/blob/master/src/main/java/Transformer.kt](https://github.com/jugglingcats/tjbpm/blob/master/src/main/java/Transformer.kt)

Is this a known issue and if so, is there any suggested workaround?

Thanks a lot, Alfie.

---

<div class="post-metadata">

**Author:** ![svtk](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/svtk/32/1499_2.png) [@svtk](https://discuss.kotlinlang.org/u/svtk)\
**Post date:** [July 24, 2013, 7:26pm UTC](https://discuss.kotlinlang.org/t/high-cpu-load-in-ide-when-making-any-code-change/769/3 "2013-07-24T19:26:53Z")

</div>

Hello, Alfie!

Yes, it looks like a known problem. It will be fixed in a while (we are currently working on it).

The&nbsp;&nbsp;compile time of your code on my machine is not bigger than compile time&nbsp;&nbsp;of 'introduction to kotlin&nbsp;&nbsp;examples' ([https://github.com/kotlin-projects/introduction-to-kotlin](https://github.com/kotlin-projects/introduction-to-kotlin)).&nbsp;&nbsp;So you can try it on your laptop if you want, and if it's comparably&nbsp;&nbsp;slow, than we know the source of a problem :) .

As a workaround suggestion you can simply wait a bit ;) or try to avoid deeply nested function literals.

---

<div class="post-metadata">

**Author:** ![jugglingcats](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jugglingcats](https://discuss.kotlinlang.org/u/jugglingcats)\
**Post date:** [July 24, 2013, 8:16pm UTC](https://discuss.kotlinlang.org/t/high-cpu-load-in-ide-when-making-any-code-change/769/4 "2013-07-24T20:16:42Z")

</div>

Hi, thanks for the quick reply! Is there a YouTrack issue I can follow for this issue?

Alfie.

---

<div class="post-metadata">

**Author:** ![jugglingcats](https://avatars.discourse-cdn.com/v4/letter/j/f17d59/32.png) [@jugglingcats](https://discuss.kotlinlang.org/u/jugglingcats)\
**Post date:** [July 25, 2013, 1:35pm UTC](https://discuss.kotlinlang.org/t/high-cpu-load-in-ide-when-making-any-code-change/769/5 "2013-07-25T13:35:03Z")

</div>

Hi, just for info, the kotlin examples project rebuilds in around 10 seconds on my laptop - compared with just under a minute for my project with nested function literals.

Alfie.

---

<div class="post-metadata">

**Author:** ![svtk](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/svtk/32/1499_2.png) [@svtk](https://discuss.kotlinlang.org/u/svtk)\
**Post date:** [July 25, 2013, 2:46pm UTC](https://discuss.kotlinlang.org/t/high-cpu-load-in-ide-when-making-any-code-change/769/6 "2013-07-25T14:46:50Z")

</div>

Hm. Ok, then we'll anyway wait the fix for the known performance&nbsp;&nbsp;problem and then return to your code to check if it compiles faster. I've created an issue about your request ([http://youtrack.jetbrains.com/issue/KT-3809](http://youtrack.jetbrains.com/issue/KT-3809)) and I'll comment to it when it's finishes. =)
