nixfmt icon indicating copy to clipboard operation
nixfmt copied to clipboard

Multithreading and performance optimization

Open oxalica opened this issue 7 months ago • 2 comments

It seems that we are only using a single thread when formatting tons of files. But this can be trivially parallelized. This should also ease the adoption of format-checking in git commit hook as mentioned in https://github.com/NixOS/nixpkgs/pull/322537#issuecomment-2196405557

Eg: fd -e nix --exec-batch nixfmt (--exec-batch passes as much files to nixfmt as possible in a single exec) It takes takes 1:49.27 (~110s) on my machine with only a single thread (~99% CPU) being occupied.

oxalica avatar Jun 28 '24 17:06 oxalica