So I get that KSP is faster than annotation proces...
# ksp
s
So I get that KSP is faster than annotation processors, but how much overhead do they add? They are incremental right?
w
Here’s one data point, Square’s Anvil can generate some Dagger factories, removing the need to run kapt. Overall the build is faster, but the overhead on kotlinc is pretty big though https://github.com/square/anvil#experimental-dagger-factory-generation
s
This is exactly the kind of thing I was looking for. Thanks!
Overall the build is faster
Isn’t it 4% slower? Faster thank kapt you mean?
the overhead on kotlinc is pretty big though
Where are you getting that from out of curiosity?
w
Yes, faster than kapt:
In our codebase we measured that modules using Dagger build 65% faster with this new Anvil feature compared to using the Dagger annotation processor:
And later on
For full builds of applications we measured savings of 16% on average.
The Kotlinc overhead I’m getting from the table, where with regular Dagger, kotlinc took 10s while with Anvil/KSP it takes almost 18 seconds. That’s not strictly KSP overhead though, as some logic has moved from Dagger to KSP (and is now executed in kotlinc) so this 8 additional seconds is some real work that needs to be done too
j
@wasyl were you able to remove the dagger annotation processor entirely from the module? How does anvil enable that?
w
@Jacob Applin I didn’t try Anvil yet. But from what I understand this experimental feature doesn’t replace Dagger completely. Instead, you can use Anvil instead of Dagger in those modules that don’t declare components, just have
@Inject
and
@Provides
annotations
j
nice I didn't know they'd added this feature I'll have to give it a try
j
Incremental is WIP, overhead is dependent on the processor itself, like how many symbols and types are being resolved for processing.