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

Give Parse effect the ability to parse concurrently #615

Open
patrickt opened this issue Jul 28, 2020 · 2 comments
Open

Give Parse effect the ability to parse concurrently #615

patrickt opened this issue Jul 28, 2020 · 2 comments
Labels
maintenance Incremental improvements performance: time must go faster

Comments

@patrickt
Copy link
Contributor

Now that #614 is taken care of (or will be soon), we need to reexamine our approach to concurrency.

The simplest big win is to change

data Parse (m :: Type -> Type) k where
  Parse :: Parser term -> Blob -> Parse m term

to

data Parse (m :: Type -> Type) k where
  Parse :: Traversable t => Parser term -> t Blob -> Parse m term

Because Parse ends up running an IO action, we can use mapConcurrently to perform said operations. Unfortunately, this requires a bit of plumbing; I’ve taken two swings at this and whiffed. Now that alacarte syntax is gone, this might be a good move.

@patrickt patrickt added performance: time must go faster maintenance Incremental improvements labels Jul 28, 2020
@patrickt patrickt changed the title Give Parse effect the ability to parallelize Give Parse effect the ability to parse concurrently Jul 29, 2020
@patrickt
Copy link
Contributor Author

patrickt commented Aug 3, 2020

I tried doing this and observed a significant performance regression with keras/keras. This makes me very sad.

@patrickt
Copy link
Contributor Author

patrickt commented Aug 3, 2020

Okay I see what the problem is here: forConcurrently is not a good solution for us: it does a lot of work per-invocation (creating an MVar and calling fork for every item in the provided list). We should do something like set up some concurrent queues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Incremental improvements performance: time must go faster
Projects
None yet
Development

No branches or pull requests

1 participant