fpco / unliftio

The MonadUnliftIO typeclass for unlifting monads to IO
Other
151 stars 51 forks source link

Faster concurrently #37

Closed roman closed 5 years ago

roman commented 5 years ago

Ensure this work gets merged.

Investigation notes:

Investigate any remaining performance enhancements (such as using less locking and more IORefs)

I tried to remove the usage of TMVar from the inner go function in the outer runFlat function. This seemed rather convoluted as then the composition of pending jobs on the FlatLiftA2 becomes particularly cumbersome.

If the current reader has any thoughts in regards to having a strategy that drops TMVar in favor of a collection inside an IORef and using atomicModifyIORef, I'm interested :-).

roman commented 5 years ago

Hey @snoyberg, let me know if the changes in this Pull Request is acceptable for our purposes. Some of the stuff I did:

Also, I spent a good chunk of the time trying to make the PR pass the CI tests, so that's why you will see most of the commits being dedicated to that.

psibi commented 5 years ago

@roman I think it would be a good idea to adapt tests from this PR here also: https://github.com/simonmar/async/pull/21/files

roman commented 5 years ago

@psibi that's a great idea, I'll try to port some of those tests for our Conc type

roman commented 5 years ago

@snoyberg I did a review with @nh2, and he was happy with most of the code, I went ahead and added a Lift constructor in addition to LiftA2 and benchmarked improved marginally. Let me know your thoughts.

roman commented 5 years ago

@snoyberg I think all the comments have been resolved, and CI is green, can you do one more check, and merge if you see if everything is good 🙏? Thank you