Skip to content

Instantly share code, notes, and snippets.

@paulp
Created May 9, 2014 18:41
Show Gist options
  • Save paulp/4d1d69700dc2e5ae01bb to your computer and use it in GitHub Desktop.
Save paulp/4d1d69700dc2e5ae01bb to your computer and use it in GitHub Desktop.
# Am I naive for thinking logs 2 through 10 should be approximately the same?
# Why does touching a single file have completely non-deterministic results?
# (I won't ask why everything has to be recompiled most of the time because a
# timestamp was updated.)
% for i in {1..10}; do touch src/compiler/scala/reflect/internal/Printers.scala && sbt --debug package &> log-$i.txt; done
% grep -i recompiling *.txt
log-1.txt:[debug] Recompiling all 1 sources: invalidated sources (1) exceeded 50.0% of all sources
log-1.txt:[debug] Recompiling all 77 sources: invalidated sources (77) exceeded 50.0% of all sources
log-1.txt:[debug] Recompiling all 450 sources: invalidated sources (450) exceeded 50.0% of all sources
log-1.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
log-2.txt:[debug] Recompiling all 450 sources: invalidated sources (450) exceeded 50.0% of all sources
log-2.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
log-3.txt:[debug] Recompiling all 450 sources: invalidated sources (417) exceeded 50.0% of all sources
log-4.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
log-5.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
log-6.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
log-7.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
log-8.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
log-9.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
log-10.txt:[debug] Recompiling all 48 sources: invalidated sources (48) exceeded 50.0% of all sources
@gkossakowski
Copy link

Touching file shouldn't trigger any recompilation. Incremental compiler keeps track of hashes of source files and will recompile only upon change of hash sum.

Is there any way I could get my hands on your project? If not, could you enable logging of ClassfileManager activity so we would get better insight what's going on here?

What you discovered already gives me some clues so I'll poke around the code that calls into ClassfileManager. The full log of activity would be more revealing.

@gkossakowski
Copy link

I looked at all calls to ClassfileManager and I didn't see anything suspicious. The code looks straightforward and correct. It would be great to learn when exactly class files get mistakenly deleted.

@gkossakowski
Copy link

@paulp, any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment