-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stamp locking slows down large builds #1129
Comments
@viveksjain Thanks for the report. For the sake of reproducibility, could you suggest exact line someone could make in the Spark code base that would reproduce this behavior please? |
Good question, when I do spark incremental builds with mvn or sbt it seems I'm not actually able to reproduce this issue (sbt takes 15-20s but profiling shows only 300ms is spent on Stamper). I don't know enough about how mvn/sbt calls into zinc, and how it's different from how we are doing it in our internal repo (with custom bazel rules), to properly understand why. Does sbt maintain a global I guess as it currently stands this issue isn't particularly actionable without a repro, feel free to close it. |
Inside the Note that Bazel wipes the timestamp to 2010-01-01, so that part of the logic may or may not work. |
That's my understanding as well from the code. In our bazel logic we create a new Stamper per compilation step (i.e. there will be no cache reuse across multiple targets), I was trying to clarify whether sbt does the same or presumably keeps one Stamper globally that gets reused across multiple compilations? |
Without exact reproduction, it is difficult to pinpoint the root cause of the issue. I looked into the stamp logic and saw no obvious fault (The only remotely problematic part I noted is that since a If the issue is still occurring on your internal repo, I guess the best we can do for now is to remove |
steps
problem
I was investigating incremental scala compilation performance, which takes O(30s) for one-line change on a large internal repo and found that quite a large fraction of time is spent blocked on Stamp locks. About 16s on this global Stamper lock
zinc/internal/zinc-core/src/main/scala/sbt/internal/inc/Stamp.scala
Line 248 in fc9e66a
zinc/internal/zinc-core/src/main/scala/sbt/internal/inc/Stamp.scala
Line 420 in fc9e66a
notes
We can improve the former by not using
timeWrapBinaryStamps
when calling zinc, but the latter seems to be used internally in zinc to wrap theReadStamps
that is passed in and cannot be removed. I am not very familiar with the code, but initial ideas:getAll*Stamps
, but I couldn't actually see where these methods are used. Is supporting them really necessary?cache
though, so it should lock on that. Using something like ConcurrentHashMap.update would likely be even faster.The text was updated successfully, but these errors were encountered: