Skip to content

The Kotlin and Groovy DSLs should have similar performance characteristics #15886

Description

@eskatos

Expected Behavior

The Kotlin and Groovy DSLs have as much as possible similar performance characteristics.
IOW there's no outlier use case for which the performance characteristics make using one or the other DSL a penalty.

Current Behavior

What follows is the current state of affairs as Gradle 6.8 for four use cases:

  • first use (e.g. ephemeral CI agent or clean workstation without build cache)
  • buildSrc abi change
  • buildSrc non-abi change
  • nothing changes

Data for Gradle 6.8

24 Jan 2025 Update (@oleg-nenashev ): As the Gradle's TeamCity instance is no longer public, the performance reports are no longer accessible. The structure has also changed since 6.8. See #32164

The data below comes from performance tests run on the Gradle CI. Those tests use a build with a large number of projects and build scripts, the build scripts being rather simple, and they run on both the Groovy and Kotlin DSL for comparison.

Old Links
Use case Groovy Kotlin Differences
First use 🟢 33.5s 🔴 76.2s Groovy DSL is 2.2x faster
buildSrc abi change 🟢 13.2s 🔴 42.3s Groovy DSL is 3.2x faster
buildSrc non-abi change 🔴 13s 🟢 5.2s Kotlin DSL is 2.5x faster
Nothing changes 🔵 1.7s 🔵 1.8s Similar performance

The numbers above are, at the time of writing, for current release branch of Gradle that is the upcoming 6.8.1. See:

This issue is a follow up to gradle/kotlin-dsl-samples#902 which resides in an archived repository.

One of the reasons the Kotlin DSL is slower when it is is the time it takes to the Kotlin compiler to compile the scripts.
See https://youtrack.jetbrains.com/issue/KT-24668

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions