tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
956 stars 83 forks source link

Support multithreading #896

Closed parsonsmatt closed 2 years ago

parsonsmatt commented 2 years ago

This PR adds support for multithreading when checking multiple files.

Motivation: for whatever reason, fourmolu is extremely slow with the newest version. I'm diagnosing how/why, but as a first pass, I thought I'd try throwing some concurrency at the problem.

EDIT: Converting to draft. This implementation has super garbled output.

parsonsmatt commented 2 years ago

Thanks for the tip on fd - I got a complete check of the codebase in 4:50 with that. Even if this doesn't land, that should get us under the threshold for updating.

Curiously, the multithreading implementation here does not result in a speedup. With --jobs 8 and the -threaded -rtsopts=-N change, we're using all cores, and mostly at 100%, but it's still taking 20 minutes.

parsonsmatt commented 2 years ago

I'm going to close this PR out since the implementation garbles output pretty badly in check mode and isn't any faster than single threaded execution. Very strange.