Skip to content
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

Kariel myrr/#4 run requests in parallel #129

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Kariel-Myrr
Copy link
Contributor

Description

Motivation:

We want to run sequence operations with backend in concurrency.

Solution:

  • Used Async effect
  • Used sequenceConcurrently instead of forM
  • Used MVar instead of StateT

Some benchmarks:


Created 1000 entries.

           Async | Sync
      Copy-Async | Copy-Sync
real	0m7.092s | real	0m8.113s
user	0m3.757s | user	0m3.394s
sys	0m1.078s | sys	0m1.102s
    Rename-Async | Rename-Sync
real	0m8.503s | real	0m9.078s
user	0m4.357s | user	0m4.138s
sys	0m1.285s | sys	0m1.204s
      View-Async | View-Sync
real	0m0.958s | real	0m1.286s
user	0m0.485s | user	0m0.414s
sys	0m0.224s | sys	0m0.209s
    Delete-Async | Delete-Sync
real	0m1.991s | real	0m2.573s
user	0m0.928s | user	0m0.899s
sys	0m0.440s | sys	0m0.396s

Related issue(s)

Fixed #4

✅ Checklist for your Pull Request

Related changes (conditional)

  • Tests

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from
      silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:

Stylistic guide (mandatory)

Problem:
We want to make cmd-s concurrently

Solution:
Use `Async` effect + `sequenceConcurrent` to run read operations in concurrency
Added it for: 
- `copyCmd`
- renameCmd 
- deleteCmd
Problem:
We want to run cmd in concurrency
But StateT isn't suitable for this task

Solution:
Use MVar for tread safe operations
Rewrite existing recursive `go` function to new realities
Now we're sorting every dir in alphabetic order  to prevent non stability from concurrency
@Kariel-Myrr Kariel-Myrr requested a review from dcastro July 30, 2022 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run requests in parallel
1 participant