Is a Sync symbol arena useful for a type checker?

TypeScript's compiler API is being rewritten in Rust: stc. This blog post says

The main problem is that tsc is itself "written in TypeScript - which does not support parallel processing". Rewriting tsc in a native language, like Rust, could speed it up immensely.

What are the parts of a type checker that can be parallelized? I'm guessing the symbols and their container arena have to be Sync. I'm finding it strange that rustc_arena::TypedArenaGen is !Sync. Is rustc not symbol solving in parallel then or I got something wrong?

rustc itself is mostly sequential, but there is parallelism in LLVM (it can codegen and optimize multiple codegen units at the same time) and cargo (it can run multiple rustc instances at the same time to compile independent crates at the same time).

There is also work ongoing to make rustc itself a bit more parallel, but there are several challenges for that, and it's not clear whether it's really worth it.

1 Like