spotbugs / discuss

SpotBugs mailing list
6 stars 1 forks source link

[question/idea] Reusing analysis information in multi-module project #16

Closed lqc closed 1 year ago

lqc commented 7 years ago

I have a fairly large project where the whole analysis can take several minutes. The project is split into Maven modules (some small, some large). Currently, the analysis is triggered separately for each project (that's how the gradle plugin works as well, AFAIK) with the classes for that project as "classes" and all it's dependencies as "auxclasspath".

I didn't do any benchmarks yet, but my intuition tells me that at least some of the effort is repeated. I'm not also sure if this is the correct way to do it, i.e. would analyzing all the projects in one go yield more accurate results then one by one ?

Another common case is that running the analysis with the same set of dependecies (you don't upgrade your libraries every day).

In both cases, I think it would be possible to reuse some of the data gathered in previous analysis as long as the "auxclasspath" did not change.

Do you think it's an idea worth exploring?

mebigfatguy commented 7 years ago

You could certainly investigate caching the first (or preliminary) passes of split pass detectors. At least the collection of information for aux classes. It probably wouldn't be too much of a disaster to prototype that. Unfortunately, the large percentage of the time is not in this first pass collection. So i'm not sure putting in all that work would in the end give you the bang for the buck you were hoping for.

lqc commented 7 years ago

Well, I measured this on a small project and the first pass takes 11s out of 34s total. The app to referenced classses ratio is about 1:2, so I guess I could cut this down to 4s and (in theory) have it run 20% faster. In case of an IDE plugin, this could be used to skip a large chunk of the first pass when only a few classes are rebuilt.

lasselindqvist commented 1 year ago

While not planned in Spotbugs itself, you might want to check out https://maven.apache.org/extensions/maven-build-cache-extension/index.html if this is still relevant to you or anyone else looking for a solution to this. That said, I do not have a ready-made example on how to cache the results of Spotbugs Maven plugin correctly.