Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

process multiple files in parallel #755

Closed
avh4 opened this issue Dec 8, 2021 · 1 comment · Fixed by #770
Closed

process multiple files in parallel #755

avh4 opened this issue Dec 8, 2021 · 1 comment · Fixed by #770

Comments

@avh4
Copy link
Owner

avh4 commented Dec 8, 2021

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
Copy link
Contributor

lydell commented Aug 20, 2022

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.

  • 1: 14.37 s
  • 2: 8.26 s
  • 4: 4.88 s
  • 6: 4.31 s
  • 8: 3.96 s
  • 10: 3.93 s
  • 12: 3.85 s

Conclusions:

  • There looks to be a speedup from parallelization here!
  • Even using just 2 cores gives a speedup, so even GitHub Actions would benefit.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants