--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/5199222e-af2c-4d37-8fbe-08628837f5bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/2aaefbe1-4c29-408c-8e56-6557ee6c13c5%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAF7sfHA7m_RK8Z17RBuCE-K3SQOqGjWLvDg%2BMss7xmZipfQ8aw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CAK-ZPemubxwZexbJxdv5BoDvmYrUdMNB73%3D%2B9COBfqTHfWxTnw%40mail.gmail.com.
Just a note: there is nothing non-functional about seeing the previous outputs. It just means your compiler is a kind of fold rather than a map function. It would still be a pure function.Standard compiler:compile :: Sources -> ArtifactsIncremental compiler:compile :: Maybe Artifacts -> Sources -> Artifacts(Using Haskell notation here)
Yes. And actually, you can imagine bazel providing easy tests for such an assertion so extension writers could verify this to be true.
--On Tue, Jan 5, 2016 at 8:00 AM, Kamal Marhubi <ka...@marhubi.com> wrote:On Tue, Jan 5, 2016 at 10:13 AM P. Oscar Boykin <oscar....@gmail.com> wrote:Just a note: there is nothing non-functional about seeing the previous outputs. It just means your compiler is a kind of fold rather than a map function. It would still be a pure function.Standard compiler:compile :: Sources -> ArtifactsIncremental compiler:compile :: Maybe Artifacts -> Sources -> Artifacts(Using Haskell notation here)Bazel would require that the incremental compilation output would be the same as the output starting from scratch. In this notation, I think bazel's requirement would be that given sources1 and sources2compile Nothing sources2 == compile (Just (compile sources1)) sources2which isn't automatically true. So it's possible for the compile to be a pure function, but for it not to satisfy proper incrementality and give bit-for-bit identical outputs for the incremental build.-Kamal
Not only is very fine-grained dependencies unmanageable, it imposes the additional restriction that the programmer find non-cyclical ways to divide the code. It can become an exercise that has no other purpose than to appease the build gods.
> if we had a hypothetical skylark API that provided ctx.previous_outputs which give me the outputs from the most recent successful build of this target, which of course may be None, then I think we'd be set.
This seems to be the only choice left. I know of no other.
> it would be quite easy to accidentally break incremental correctness in rules with such a property.
It's already an understanding among rule writers that it should be deterministic. E.g. don't depend on /dev/random. Also, don't depend on undefined behaviors.
E.g. https://github.com/google/closure-compiler/issues/438 Okay, that's not the best example because it was due to a different Java version, but I've seen *many* times where Google Closure Compiler in the past failed code on one machine but passed it on another machine with an identical Java version. (Maybe a race condition, maybe some other randomness introduced by the Java runtime.)
Point is, there's no magic force than can prevent a rule-writer from writing non-deterministic code.
---
It's actually rather ironic. The FAQ
> Bazel tries to minimize expensive compilation steps. If you are only using interpreted languages directly, such as JavaScript or Python, Bazel will likely not interest you.
Yet for expensive compilation -- Scala, Rust, Haskell -- those are exactly the cases that Bazel makes hugely **slower**. I'd like to be able to support these incremental compilers, and any others.
Please don't make it {Fast, Correct} - Choose one
+Ulf Adams FYI, as we talked this morning about how / whether to support stateful compilers.On Wed, Jun 8, 2016 at 10:57 PM <pa...@lucidchart.com> wrote:> Unfortunately I don't have any constructive suggestions right now, except that...breaking your targets up into smaller ones may be the best solution.
Not only is very fine-grained dependencies unmanageable, it imposes the additional restriction that the programmer find non-cyclical ways to divide the code. It can become an exercise that has no other purpose than to appease the build gods.
> if we had a hypothetical skylark API that provided ctx.previous_outputs which give me the outputs from the most recent successful build of this target, which of course may be None, then I think we'd be set.
This seems to be the only choice left. I know of no other.
> it would be quite easy to accidentally break incremental correctness in rules with such a property.
It's already an understanding among rule writers that it should be deterministic. E.g. don't depend on /dev/random. Also, don't depend on undefined behaviors.
E.g. https://github.com/google/closure-compiler/issues/438 Okay, that's not the best example because it was due to a different Java version, but I've seen *many* times where Google Closure Compiler in the past failed code on one machine but passed it on another machine with an identical Java version. (Maybe a race condition, maybe some other randomness introduced by the Java runtime.)
Point is, there's no magic force than can prevent a rule-writer from writing non-deterministic code.
So, (especially as a Scala programmer ;) I understand the conundrum.
> There is an additional question of whether they can be enabled by default (and disabled on release builds?) or disabled by default and enabled on interactive builds, which is orthogonal to the first.
I'm not sure what is meant by the first option. The second sounds great.
I have no problem with a CI server compiling in whole package units. I just can't ask devs to wait minutes in between their one-line changes.
> We have a well-defined API to support incremental compilers.
> For example, we've done (hundreds of?) thousands of builds with the incremental Java compiler
I wasn't aware you used an incremental Java compiler. Do you use Ant's, or Eclipse's, or one of your own design?
Can you point to me the code?
Java shares Scala's problem that only *after* compilation (or a step just as expensive) can dependencies be determined. I.e. there isn't (and can't be) a `gcc -M` equivalent that can run before hand.
So anyway, I'm very interested in seeing what has been done with Java.
This says that Bazel does *not* use an incremental java compiler.
https://groups.google.com/d/msg/bazel-discuss/TVAJeoL8xmI/SEDJsuwbBQAJ
No, honestly I haven't used Bazel for Scala at all.
I just know our compilation with sbt. Even with the "worker process" optimization that sbt essentially already does, a clean build on a respectable laptop can be a couple minutes for a single project.
We have several dozen projects with 1-30 source files, a couple dozen more with 31-200 source files, and several projects with 200-600 source files. The larger ones use the Play framework, which does a fair bit with implicits. Oh, and tests (specs2) are on top of those numbers, which use even more implicits.
Sure, we can start teasing the big projects apart in non-cyclical ways. I won't say that would be a bad thing. But it's just not something devs have to worry about now. Adopting Bazel today either requires either refactoring ten of KLOCs of code, or incurring massive hits to build times. I can't sell that.
> I would like to find time to add support for bazel's worker processes.
Is a worker process not subjected to the same sandboxing requirements? Is that how you used zinc?
(Also, do you know much about fsc? Is that just a worker process?)
> I think we can get a lot of win just instantiating a new standard compiler but have the jit able to have run on the code.
This would have build times similar to `sbt compile clean compile`. Nice, but not great.
--
You received this message because you are subscribed to a topic in the Google Groups "bazel-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bazel-discuss/3iUy5jxS3S0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/cc8e6f99-78ea-452d-ad58-96cb3e3701e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
> We have a well-defined API to support incremental compilers.
What is this API?
> For example, we've done (hundreds of?) thousands of builds with the incremental Java compiler, and we haven't encountered any correctness issues recently. However, back when I experimented with it, Javac was using second-precision timestamps to detect file changes, even on file systems that actually support sub-second timestamps, and this was causing issues in some scenarios. Before enabling incremental Java compilation by default, it would be good to check whether that specific issue was fixed or change the Java compiler to use an external source of change notifications, e.g., Bazel passes file content checksums to the worker which could be used instead of timestamps.
Everything I read says that Bazel has no Java incremental compilation, beyond individual libraries.
https://groups.google.com/forum/#!searchin/bazel-discuss/incremental$20java%7Csort:relevance/bazel-discuss/TVAJeoL8xmI/gM2yf3PEBAAJ
https://groups.google.com/forum/#!searchin/bazel-discuss/incremental$20java|sort:relevance/bazel-discuss/qr2wbm6pitg/Kk1xH6WXEwAJ
What's the story?
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/3f48734e-19d2-43aa-8a20-1e887ab47ca0%40googlegroups.com.
+Ulf Adams Can you confirm what you wrote in an earlier mail on this thread about incremental compilers?I'm not aware of any such support myself, besides allowing persistent workers to keep state in memory between work requests. This is proven to help with performance, for example by not having to parse unchanged input files over and over again.The more traditional approach of feeding the output files of the last run of an action as additional inputs to the next run is something that AFAIK Bazel doesn't support.There have been requests for that in the last years, but we've always been wary of adding this feature. We once had something like that for incremental linking, I think, but it was removed because it made the code very complex, hard to reason about correctness and didn't help much in the end.
On Mon, Dec 19, 2016 at 5:30 AM <pauld...@gmail.com> wrote:
Apologies for dredging this up, but I wanted to get clarification on two points
> We have a well-defined API to support incremental compilers.
What is this API?
> For example, we've done (hundreds of?) thousands of builds with the incremental Java compiler, and we haven't encountered any correctness issues recently. However, back when I experimented with it, Javac was using second-precision timestamps to detect file changes, even on file systems that actually support sub-second timestamps, and this was causing issues in some scenarios. Before enabling incremental Java compilation by default, it would be good to check whether that specific issue was fixed or change the Java compiler to use an external source of change notifications, e.g., Bazel passes file content checksums to the worker which could be used instead of timestamps.
Everything I read says that Bazel has no Java incremental compilation, beyond individual libraries.
https://groups.google.com/forum/#!searchin/bazel-discuss/incremental$20java%7Csort:relevance/bazel-discuss/TVAJeoL8xmI/gM2yf3PEBAAJ
https://groups.google.com/forum/#!searchin/bazel-discuss/incremental$20java|sort:relevance/bazel-discuss/qr2wbm6pitg/Kk1xH6WXEwAJ
What's the story?
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/3f48734e-19d2-43aa-8a20-1e887ab47ca0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CA%2BAhZoi-LQ7hBFEC8Zk08vgnAMrh%3D3ki4rNpGdSMmydwHVkRJg%40mail.gmail.com.To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.
My current plan, FYI, was to disable sandboxing, run zinc (https://github.com/typesafehub/zinc), and squirrel away files. (Or I guess I could keep sandboxing and keep memory.)
> That said: What are we trying to achieve here? Good performance scala builds?
Yes. Specifically, good performance when after making small changes and building locally -- i.e. the developer edit-compile-test cycle. CI builds can take longer; don't care.
> If that's the goal, then we should look at that more specifically to see what exactly is needed to make scala builds perform well
FYI, there are two major projects to improve over scalac performance: fsc and zinc. fsc runs as a daemon and caches stuff (not sure about these details). zinc monitors file/class dependencies during compilation writes the details to files. The latter has a number of sophisticated optimizations like optimistic compilation (recompile for just the known changes, possibly adding to that set and starting again) or public interface hashing (I think Buck does this too). It is the choice of sbt, the most popular build tool for Scala projects.
Martin Odersky, the creator of Scala and scalac provides some insights about Scala compile times: http://stackoverflow.com/questions/3490383/java-compile-speed-vs-scala-compile-speed/3612212#3612212
> and - in particular - set up at least one benchmark that we can measure and play with to see what the impact of the various options is. Ultimately, if making scala compile fast requires making certain assumptions more explicit, or even providing a new API, then I'm all for it.
> However, I'm against trying to come up with a framework if we haven't even looked at a specific use case or three (three would be better), or providing APIs without first collecting actual data that demonstrates the need for said APIs.
Very fair.
I could help here, given some more detail. A project that comes to mind is the Play framework (https://github.com/playframework/playframework). It's the most popular Scala web framework and includes Java support as well. It's already organized into a couple dozen projects and builds with sbt.
Are you looking to see what happens if we use bazel on this project? If we change one line, how long compilation takes?
---
While concrete example are invaluable, I want to point out that this isn't an issue unique to Scala. Currently, Bazel has very good support for Google's languages, like Go, Java, C/C++. These either compile rather quickly (Go, Java) or have easily-determined per-file relationships (C/C++).
There are languages like Scala and Rust (and maybe Swift?) that take much longer to compile, mostly because of type inference. These already have stateful compilers that could greatly improve the usability of Bazel.
This requires that you generate rules without cyclical dependencies, no? And the same with your approach at Stripe?
> 0) build a zinc rules that could use zinc to automatically create minimal build files for a directory. In this way, the user only manages he dependencies of one directory but then periodically regenerates static targets that are minimized. This may make the tiny build target approach more palatable.
This requires that you generate rules without cyclical dependencies, no? And the same with your approach at Stripe?
--
You received this message because you are subscribed to a topic in the Google Groups "bazel-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bazel-discuss/3iUy5jxS3S0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/8473efcd-25da-44bb-af1f-04100ab0994c%40googlegroups.com.