Online / 5 & 6 February 2022


DataClassGenerate. Shrinking Kotlin data classes

This talk is a deep dive into Kotlin data classes optimisations. We will find what optimisations are possible, and how to apply them with Kotlin compiler plugins and Android optimisers.

This talk: 1. Observes data classes inefficiencies in Android apps 2. Observes state of industry optimisation tooling (compiler plugins, R8, Redex, ProGuard)

- Gives a brief into Kotlin Compiler Plugins (m/b not)
  1. Applies simple optimisation techniques to data classes
  2. Describes Object class method overrides (equals, hashCode, toString) optimisation problem.
    • Describes DataClassGenerate approach
      1. @DataClassGenerate annotation
      2. DataClassGenerate compiler plugin
      3. Kotlin Compiler plugin interaction with Redex


Sergei Rybalkin