Kotlin-dsl-samples: Classpath discovery at configuration time should be reduced

Created on 18 Apr 2018  路  5Comments  路  Source: gradle/kotlin-dsl-samples

Looking at graphs produced by our performance testing infrastructure we can see that it consumes a lot of memory and does way too much classpath discovery.

See this help on the gradle build comparing gradle build.

Especially this allocation-tlab graph. Search for KotlinBuildScriptCompiler, you'll see it accounts for 30% of memory allocations, KotlinBuildScriptCompiler.<init> for 20%.

It appears that we visit too much classloaders to infer their classpath, too many times. A lot of this should be avoidable to make configuration time faster. It is definitely the case when one script has no dependencies, parent scope classpath could be reused directly. Something along the lines of this logic that does the exact same thing reusing classpaths would help.

feature kotlin-dsl-runtime performance

Most helpful comment

And 25% leaner, nice work!

All 5 comments

Seems ClasspathUtil is responsible for 20% of the allocations.

Caching the classpath computation should do the trick. Right now it walks the very same class loaders again and again.

Closing as delivered, new version is ~6% faster.

And 25% leaner, nice work!

The performance test infrastructure makes it a joy.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xmlking picture xmlking  路  3Comments

deeprim picture deeprim  路  4Comments

cbeams picture cbeams  路  3Comments

cbeams picture cbeams  路  5Comments

jaredsburrows picture jaredsburrows  路  3Comments