Faster compilation when having many programs

At some point, if you keep adding programs to the same openrndr-template things will start to get slow in IntelliJ Idea. I have now 84 programs and 114 kotlin files and it’s quite noticeable.

I figured out a solution.

I was throwing all my programs into a package called apps. What I did:

  • Add a second package where to store active programs. You could call the old package archived and the new one current.
  • Go to File > Project Structure > Modules > main > Sources.
  • Right click on the package to deactivate (archived or apps in my case).
  • Flag it as Excluded.

That’s it. Idea will no longer look into this folder, making everything fast again. In my case it compiles faster and autocomplete is much faster too.

Note: you can move programs back and forth between both folders. Move a program into current to work on it again, throw it into archive if you’re done for now.

What do you think about this approach? Do you know better ways to improve performance on growing collections of programs? I could clone the openrndr-template template again and start from scratch, but I want to have access to all the helpers and classes I’ve built so far (my packages called math, geometry, random, etc).


thank you! I was noticing this too

@abe Which Kotlin and Gradle versions are you using?

In my system I have this:

Gradle 6.5

Build time:   2020-06-13 14:39:45 UTC
Revision:     <unknown>

Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_252 (Oracle Corporation 25.252-b09)
OS:           Linux 5.7.6-arch1-1 amd64

But here

I see gradle 6.4

What’s the right way to check those values @dector ? And what impact does it have?

cd /path/to/your/projects
./gradlew --version

will should you values for the project.

I’m also using archive + libs + workbook strategy for genart project (mostly because I was compiling with K/JS and output js file was growing too fast, compiling/loading too slow).

However, on other projects (Gradle 6.5 + Kotlin 1.3.72) I’ve notices huge improvement in incremental compilation speed. I guess its because of the latest improvements in Gradle (e.g. see comparison between Gradle and Bazel).

Also there are few new options to speed-up build (Configuration cache and File System watching).

Also JB focusing on improving compiler speed in 1.4 release. We’ll see. But preliminary numbers seems very nice. :smiley:

1 Like

With K/JS do you mean javascript? with openrndr?

Yup, Kotlin/JavaScript. But I was using my own tool, not OpenRNDR.

Ah cool. Can you share anything about your tool? What can you do with it? Does it use WebGL?

@abe Sorry, missed notification about your message. I was using old Kotlin JS compiler with output to Canvas previously but now re-implementing it to use Skia instead.

Focused mostly on static images and data-driven result.

Oh nice, how’s your experience with Skia? What language / framework are you using with it? I see Skia is written with C++17…

Yes, Skia itself is built in C++ but has bindings to many languages. Just recently JetBrains released quite good Java binding for it (GitHub - JetBrains/skija: Skia bindings for Java) and Kotlin MP bindings (GitHub - JetBrains/skiko: Kotlin MPP bindings to Skia). I’m using Kotlin with skiko (it has built-in window management toolking).

Skia is widely used these days by different vendors and seems like proper drawing 2D library for JVM (finally :slight_smile: ).