# Parallelizing rustc using Rayon

**URL:** <https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606>\
**Category:** compiler\
**Created:** [January 19, 2018, 4:45am UTC](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606 "2018-01-19T04:45:45Z")\
**Posts on this page:** 5\
**Page:** 3

<div class="post-metadata">

**Author:** ![nikomatsakis](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/nikomatsakis/32/5410_2.png) [@nikomatsakis](https://internals.rust-lang.org/u/nikomatsakis)\
**Post date:** [February 28, 2018, 6:41pm UTC](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606/41 "2018-02-28T18:41:57Z")

</div>

Seems like @Zoxc has already started in on this! 🎸 💃 🎸 🤸‍♂️ 🎸

---

<div class="post-metadata">

**Author:** ![gbutler](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/gbutler/32/3670_2.png) [@gbutler](https://internals.rust-lang.org/u/gbutler)\
**Post date:** [March 8, 2018, 1:07pm UTC](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606/42 "2018-03-08T13:07:10Z")

</div>

In the above discussion, you talk about:

- B – Depends on --\> A – Depends on --\> C

It is confusing to read about because, well, “A, B, C”. It would be easier to read the explanation if you said:

- A – Depended on by --\> B – Depended on by --\> C

And update your explanation of A, B, C to reflect that dependency.

---

<div class="post-metadata">

**Author:** ![mark-i-m](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/mark-i-m/32/3167_2.png) [@mark-i-m](https://internals.rust-lang.org/u/mark-i-m)\
**Post date:** [December 18, 2018, 5:39am UTC](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606/43 "2018-12-18T05:39:08Z")

</div>

What happened here anyway? I recall a floury of activity and the everything seemed to go silent…

---

<div class="post-metadata">

**Author:** ![Zoxc](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/zoxc/32/4000_2.png) [@Zoxc](https://internals.rust-lang.org/u/Zoxc)\
**Post date:** [December 19, 2018, 12:40am UTC](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606/44 "2018-12-19T00:40:16Z")

</div>

Here is a status update for you. This is now implemented in `rustc` in a more limited form which blocks when a query need to wait on another query on another thread instead of using fibers. The performance of that approach is still good, here is a [recent benchmark](https://perf.rust-lang.org/compare.html?start=bcf920fc2707c3f126a2963a686ed800eeea49e6&end=80b4e73ec537d4d0092cc4c23289e52d951a3384&stat=wall-time). Incremental compilation does take a performance hit and could use further optimization for parallel execution. There’s still room for further parallelization too, in particular LLVM IR generation is not yet parallel, which my experimental branch had.

You can test out this by building `rustc` with `[rust] experimental-parallel-queries = true` in `config.toml`. You can then adjust the size of the thread pool used with `-Z query-threads=n` and it currently defaults to 1.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:29am UTC](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606/45 "2019-03-25T08:29:33Z")

</div>

Closed on March 25, 2019, 8:29am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

[Previous page](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606.md?page=2)
