avh4 / elm-format

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
BSD 3-Clause "New" or "Revised" License
1.31k stars 148 forks source link

process multiple files in parallel #755

Closed avh4 closed 1 year ago

avh4 commented 2 years ago

Processing of each file is independent. Would it be faster overall if they were allowed to run in parallel? I'd expect that elm-format is mostly disk-bound, but maybe that's not the case with SSD drives or with caching in modern systems?

If it can be faster, we'd want to be careful to use a haskell library that would appropriately manage resources and not start additional threads if CPU usage or memory usage is already high.

lydell commented 2 years ago

This would be great, I think!

At work we have 726 Elm files. Letting one elm-format --validate check them all takes 15 seconds, while spreading the files out evenly on multiple elm-format --validate calls in parallel takes down to 4 seconds.

I tried a bunch of different numbers of parallel elm-format --validate, up to 12 which is the number of cores on my laptop.

Conclusions: