alexo/wro4j — pull request #202 by muffl0n (2014-09-05 09:36:29+00:00)
Title: Optimize how often files are checksummed

In #189 we already discussed that persistingFingerprint was taking more time than it should. I looked into this and found that files that are included by many different files get fingerprinted every time.
The problem is that you can't just ask the BuildContextHolder if it has a value for the key (URI of the resource) because it would return the value for this key stored in a former build.

So I added a set to BuildContextHolder that stores if the key was set in the current run. This set is not persisted so it only contains keys that are recently set. ResourceChangeHandler then asks the BuildContextHolder if the value (checksum) for the key (URI of the resource that should be fingerprinted) has already been calculated in this run. If this is true it just skips the costly fingerprinting of said resource.

This way we save a lot of time in incrementalBuilds. We got our building time down 84% to 2s from 13s without the optimization.

I'm not quite happy with the wording though. So this is more a prove of concept that works remarkably well with our setup. Yes, we have a **lot** of includes and cascaded files. :)