google-code-export / wro4j

Automatically exported from code.google.com/p/wro4j
1 stars 1 forks source link

Optimize how often files are checksummed #897

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
persistingFingerprint is 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.

References:
https://github.com/alexo/wro4j/pull/202

Original issue reported on code.google.com by alex.obj...@gmail.com on 5 Sep 2014 at 12:32

GoogleCodeExporter commented 9 years ago
Fixed in branch 1.7.x

Original comment by alex.obj...@gmail.com on 10 Sep 2014 at 9:02