-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallelise s3 cache probing #97
Conversation
Generated by 🚫 Danger |
@mheinzel Great work! Thanks a lot! I think I like commit 0097856 the most. I'm very tempted by f1978ca as well because it deletes some code. However the pattern so far has been:
and this commit would break the pattern. It's debatable if this philosophy was a good approach to begin with, the intention was to remove the cognitive load of the Commit 4040f43 imho is less readable, introduces |
I tried it out and seems to work to me. The speed up is pretty impressive. It's almost instant. This can probably be done for downloading and uploading at well but I wonder if it makes sense to split the bandwidth. Also there is printing when downloading/uploading operations take place, probably output on console will be garbled and out of order. Something to consider. |
I don't think the pattern is bad, but in this situation it seems a bit too fine-grained. Also, what makes it so verbose here is that there are so many arguments you just need to pass through, but have to mention again and again (and the type signatures get pretty long). Regarding |
By the way, should upload and download of artifacst be parallelised as well? |
I suggest to proceed with the following in this PR:
leave the rest out (for now). I think the Env Data structure going forward would be a nice solution for the verbosity of the arg passing. Some of the arguments are already hidden in the reader. Probably as you suggested time ago since there is a lot of ReaderT combinations this approach can be used: https://hackernoon.com/the-has-type-class-pattern-ca12adab70ae Also, don't know if relevant but there is this: https://www.fpcomplete.com/blog/2017/07/the-rio-monad Once the Env is there then probably it makes sense to take a look again and maybe crush the wrappers that just map over stuff. About uploading/downloading of artifacts:
If you want to take a stab at this it would be great. Obviously that would be a different PR. |
Sure, let's just merge the first commit. Downloading multiple files concurrently could be faster in some situations, but not as much as in this case. The perfect number of concurrent downloads depends on a lot of factors... |
@mheinzel will you push force just the first commit or should we do this? |
merged! 🎉 |
Just gave #79 a try.
Disclaimer: I don't have a Carthage dev environment, so this it completely untested (but it typechecks 😉 ).
Please try if it works as intended before merging!
Commit 1 just parallelises the requests with minimal changes to existing code using
async-lifted
.async
in itself is a really nice library, but it wants the parallelised actions to beIO
actions and since we have aReaderT s IO
here, we can't use it.async-lifted
provides a more general interface usingMonadBaseControl
which we can use.Commit 2 makes the code more concise, removing one top level function. I find this version to be more understandable (less passing around of long arguments), but that might be different for other people.
Commit 3 avoids
MonadBaseControl
and uses plainasync
, but needs to do some additional gymnastics to run the ReaderT.By deciding which commits to pick, you can choose the version you want ;)
Minimal changes, more concise, avoiding async-lifted...