2 ms·
How do they guarantee both deterministic results and parallelism?
by tripdout 2y ago
How do they guarantee both deterministic results and parallelism?
- rockwotj 2y agoDeterminism: via sandboxing builds, it’s a little leaky by default (but getting better). See https://bazel.build/basics/hermeticity https://bazel.build/basics/hermeticity Parallelism: Easier with sandboxing, but the build declares all inputs/outputs so it builds a merkle tree and strictly inforces a DAG. This way you can parallelize independent subgraphs and cache at a fine grained level.
- laurentlb 2y agoThe evaluation of a file happens in a single thread. At the end of the file evaluation, Starlark exports the values and functions defined in the file. All values are frozen, meaning they won't ever be mutated. Since no shared object can be modified, you can have any number of threads reading the object. So you can safely evaluate many files in parallel. Caveat: this assumes the interpreter doesn't expose functions like reading/writing on a disk, etc.