Allow concurrent evaluation #170
Labels
challenging
May require somewhat complex changes; not recommend if you aren't familiar with the codebase
enhancement
Betterness, without new explicit feature possibilities
help wanted
When someone explicitly requests for help
Uh oh!
There was an error while loading. Please reload this page.
Right now parsing is our slowest task, and yet parsing occurs during evaluation all the time due to
import
expressions. It would be nice if we could assign a pool of N workers (using theasync-pool
library), and perform these slow evaluations concurrently since none of them can have interfering side-effects. This should speed up the evaluation ofnixpkgs
considerably if there are many capabilities available.To do this will need a few steps:
Make
Thunk.hs
thread-safe by introducing a variable that causes other threads to wait for pending evaluations to complete. Right now there is a boolean flag in anIORef
; it might be sufficient to just turn this into a trinary flag in aTVar
.Create
MonadConcurrent
to abstract when concurrent evaluation is possible. It wouldn't be for the symbolic evaluator, for example, but would for an evaluator that runs in IO, such asLazy
.Replace the calls to
traverse
that happen inExec.hs
forNList
andNSet
to instead use a newconcurrentTraverse
method defined inMonadConcurrent
, which for IO would be implemented by callingControl.Concurrent.Async.Pool.mapTasks <group>
and for pure evaluation would just calltraverse
as before.Pinging @ryantrinkle, who requested this feature.
The text was updated successfully, but these errors were encountered: