Has anyone noticed a performance regression betwee...
# gradle
s
Has anyone noticed a performance regression between 1.7.20 and 1.7.10 when running an incremental build on a multi-module Android project? Gradle profiler shows 2-10% slowdown on our project depending on which module incremental changes are applied to.
t
execution or configuration time regression? With new IC or old one?
and are you using Kotlin android extensions?
s
Execution time measured as duration of bundleDebug. IC - default. We are using Parcelize plugin and kapt. Not using Android extensions plugin
t
could you try new IC? should be pretty stable in 1.7.20
btw what change causing the biggest slowdown - api or non-api one?
another thing you could do - is enable Kotlin build reports and then compare where IC execution time has raised
s
thanks, I'll try the new IC
a
You can also get information about build reports mentioned by Yahor from this blogpost: https://blog.jetbrains.com/kotlin/2022/06/introducing-kotlin-build-reports/
s
@tapchicoma here are some metrics after ABI change in a deep module Kotlin 1.7.10 + old IC:
Copy code
Time metrics:
  Total Gradle task time: 94.63 s
  Task action: 18.65 s
    Backup output: 9.96 s
    Connect to Kotlin daemon: 3.78 s
    Clear jar cache: 0.11 s
    Calculate output size: 0.52 s
    Run compilation: 6.91 s
      Incremental compilation in daemon: 1.79 s
        Store build info: 0.07 s
        Calculate initial dirty sources set: 0.83 s
          Analyze dependency changes: 0.61 s
            Find history files: 0.06 s
            Analyze history files: 0.02 s
          Analyze Java file changes: 0.00 s
          Analyze Android layouts: 0.00 s
          Detect removed classes: 0.01 s
        Update caches: 0.00 s
        Sources compilation round: 0.14 s
        Write history file: 0.08 s
  Compiler initialization time: 0.02 s
  Compiler code analysis: 0.10 s
  Compiler code generation: 0.01 s

Size metrics:
  Total size of the cache directory: 254.8 MB
    ABI snapshot size: 33.3 KB
  Total compiler iteration: 1
1.7.20 + new IC:
Copy code
Time metrics:
  Total Gradle task time: 126.89 s
  Task action: 20.82 s
    Backup output: 10.53 s
    Connect to Kotlin daemon: 4.00 s
    Clear jar cache: 0.15 s
    Calculate output size: 0.46 s
    Run compilation: 16.67 s
      Incremental compilation in daemon: 10.76 s
        Store build info: 0.12 s
        Calculate initial dirty sources set: 8.24 s
          Compute classpath changes: 8.21 s
            Load current classpath snapshot: 0.94 s
              Remove duplicate classes: 0.87 s
            Shrink current classpath snapshot: 6.29 s
              Get lookup symbols: 0.51 s
              Find referenced classes: 2.11 s
              Find transitively referenced classes: 3.66 s
            Load shrunk previous classpath snapshot: 0.69 s
            Compute changed and impacted set: 0.29 s
              Compute class changes: 0.25 s
                Compute Kotlin class changes: 0.24 s
                Compute Java class changes: 0.00 s
              Compute impacted set: 0.02 s
          Analyze Java file changes: 0.00 s
          Analyze Android layouts: 0.00 s
          Detect removed classes: 0.01 s
        Update caches: 0.02 s
        Sources compilation round: 0.62 s
        Write history file: 0.08 s
        Shrink and save current classpath snapshot after compilation: 0.90 s
          Save shrunk current classpath snapshot: 0.74 s
  Compiler initialization time: 0.21 s
  Compiler code analysis: 0.36 s
  Compiler code generation: 0.03 s
  Classpath entry snapshot transform: 0.02 s
    Load classes: 0.00 s
    Snapshot classes: 0.02 s
      Read basic information about classes: 0.00 s
      Find inaccessible classes: 0.00 s
      Snapshot Kotlin classes: 0.01 s
      Snapshot Java classes: 0.00 s
    Save classpath entry snapshot: 0.00 s

Size metrics:
  Total size of the cache directory: 331.0 MB
    ABI snapshot size: 33.3 KB
  Total compiler iteration: 3
  Number of times 'ClasspathEntrySnapshotTransform' ran: 1
    Size of jar classpath entry: 1.7 MB
    Size of jar classpath entry's snapshot: 539.7 KB
  Number of times classpath changes are computed: 335
  Number of times classpath snapshot is shrunk and saved after compilation: 336
    Number of classpath entries: 28089
    Size of classpath snapshot: 4.8 GB
    Size of shrunk classpath snapshot: 202.4 MB
  Number of times classpath snapshot is loaded: 335
    Number of cache hits when loading classpath entry snapshots: 28027
    Number of cache misses when loading classpath entry snapshots: 1
1.7.20 + old IC:
Copy code
Time metrics:
  Total Gradle task time: 134.97 s
  Task action: 21.14 s
    Backup output: 10.77 s
    Connect to Kotlin daemon: 4.47 s
    Clear jar cache: 0.12 s
    Calculate output size: 0.44 s
    Run compilation: 6.73 s
      Incremental compilation in daemon: 1.62 s
        Store build info: 0.09 s
        Calculate initial dirty sources set: 0.76 s
          Analyze dependency changes: 0.57 s
            Find history files: 0.06 s
            Analyze history files: 0.02 s
          Analyze Java file changes: 0.00 s
          Analyze Android layouts: 0.00 s
          Detect removed classes: 0.01 s
        Update caches: 0.00 s
        Sources compilation round: 0.13 s
        Write history file: 0.08 s
  Compiler initialization time: 0.02 s
  Compiler code analysis: 0.08 s
  Compiler code generation: 0.02 s

Size metrics:
  Total size of the cache directory: 255.1 MB
    ABI snapshot size: 27.6 KB
  Total compiler iteration: 1
t
btw which Gradle version are you using?
s
Gradle 7.5.1
FWIW configuration time remains the same as configuration cache is enabled.
a
Could you please collect build report with disabled parallel mode and 1 worker?
Is it also possible to share with us build scan?