Why parallelise the parser?
Why parallelise the parser?
Posted Nov 1, 2024 15:49 UTC (Fri) by atnot (guest, #124910)In reply to: Why parallelise the parser? by anton
Parent article: The performance of the Rust compiler
My probably outdated memory is that the main point is being able to kick stuff to LLVM sooner. As mentioned the codegen is parallel already, but those threads only get spawned sequentially and all of them have to finish, across all crates, before linking can start. This means that if, say, you get unlucky and a heavy task gets started towards the end, you'll be waiting a while. With a parallel frontend you get to start those tasks earlier, which indeed doesn't affect the bulk of the runtime, but lessens the impact from stagglers. The parser is particularly relevant bottleneck there because you can't really start to divide up the work until you've traced all of the modules and imports and know what you need to compile.