Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Slow UP-TO-DATE checks if filtered FileTree inputs are used #8559
In the Android Gradle plugin, we have observed that when we used a filtered FileTree as a task's input, the UP-TO-DATE check for that task would take a long time. I'm not sure whether the "filtered" part or the "FileTree" part makes it slow, or both.
Example input in AidlCompile (reported by an AGP user as a side issue at https://issuetracker.google.com/121251997):
Example input in DexMergingTask (tried internally then reverted due to performance regression):
I'm filing this bug to check if the slowness is expected, and whether something needs to be fixed in Gradle or the way we use filtered FileTree to reduce this overhead.
The slowdown is probably due to Gradle not caching the file system state for filtered file trees. So every time the input is checked for changes, the whole file tree needs to be inspected again.
If there is no pattern, then the whole file tree is cached in memory and returned next time it is queried.
For the dex files, it think that
Thanks for your explanation!
That's a good tip regarding
@devisnik and I talked at Droidcon Berlin and we were able to reproduce this in one of my projects when using the following fileTree as an input:
fun Project.editorconfigFiles() = fileTree(mapOf("dir" to ".", "include" to "**/.editorconfig"))
Reference to the open source plugin:
Sample run on my Macbook with my project: