bloop icon indicating copy to clipboard operation
bloop copied to clipboard

Improve runtime performance of no-op compilations

Open olafurpg opened this issue 6 years ago • 2 comments

Currently, no-op compilation for targets with a large classpath can sometimes be slow. The profile below hints that slow no-op compilation is bottlenecked by java.io.File.isDirectory(), which invokes the native system call stat64

Screenshot 2019-11-12 at 10 37 37

Full profile: nop.svg.zip

It would be nice to use alternative native APIs to testing which files are directories. For example, https://github.com/swoval/swoval.

olafurpg avatar Nov 12 '19 21:11 olafurpg

Thanks for reporting! Yes, I've wanted to use swoval for a few weeks now. We should avoid expensive stat64 operations as much as possible to speed up no-op compilations, class path hashing and other IO-intensive tasks the compilation engine.

I don't think I'll have the time to look into this any time soon but I'm very open to accepting PRs contributing this feature. I'd recommend going through all the call-sites of isDirectory in the codebase and replacing them with swoval APIs.

Paging @eatkins in case he wants to be in the loop.

jvican avatar Nov 12 '19 22:11 jvican

I’d be happy to provide guidance and PR feedback but I’m mostly taking a break from open source right now.

eatkins avatar Nov 13 '19 02:11 eatkins