Sorry for bumping the old thread, but I cannot find any information about parallel builds in the documentation.
Since the search for parallel builds returns this topic only, I think it would be good to add some links to the docs about enabling multiple build jobs (rather than creating new topic fully duplicating this one).

I know this is an old thread but its 2019, I am using PIO 3.6.4 on Visual Studio, and compiling ESP-IDF projects is insanely slow and painful as it still compiles every single source file individually, how do I enable parallel building on this version?

Have you run up a task manager to check what the processor core usage is? Unless you fiddle with the platformio.ini file, does platformio not only rebuild modified files? Meaning that subsequent builds are much, much faster?

I can confirm looking at task manager it is compiling in parallel, but the annoying part is that any new file, removing of a file, or even changing platformio.ini will cause a clean compile, and re-compile the entire IDF when really I see no reason that the IDF should have to be compiled unless you downloaded an update or modified something in the core. Most other make tools for ESP do this, you only get a single compile of the IDF libraries which is then linked against.

Changing the platformio.ini always triggers a re-compile, so it’s best to avoid doing that where possible. As to why adding/removing other files would trigger a re-compile I don’t know the reasoning for, but it does happen. If you simply remove the #include of another file it won’t do a complete re-compile, so it seems adding/removing files is considered a significant enough change to trigger a rebuild… whether it is needed or not. It would be nice to see if that could be made a bit smarter.