Makefiles generator on WSL works significantly slower


I’ve got a WSL 2 machine with LLVM project under /mnt directory. I’ve noticed that running CMake on this project with Unix Makefile generator takes significantly more time than with Ninja generator. With Ninja it takes ~3-4 mins, with Makefiles it takes ~15-20 mins.

AFAIK, WSL 2 file-system is relatively slow for directories located under /mnt ([wsl2] filesystem performance is much slower than wsl1 in /mnt · Issue #4197 · microsoft/WSL · GitHub). However, I was wondering what’s the difference between Ninja and Makefiles here? Does Makefiles generator access file-system more often than Ninja?

You probably trace the system calls for file-system operations and see the difference between Ninja/Makefiles. I am guessing you are correct and the makefiles are doing more work than neccessary.

Also yes. WSL2 it is highly advised you do NOT use /mnt/… due to performance reasons. The builds are extremely slow if you use /mnt/…

The Ninja generator writes a handful of files (usually just 2 IIRC) while the Makefiles writes something like 10 per directory, so yes, there is a lot more filesystem traffic for the Makefiles generators.