commercialhaskell / commercialhaskell/stack
Room to optimize fast path for Haskell shell scripts run via stack?
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
I absolutely love being able to make self contained shell scripts like this:
``` Haskell
#!/usr/bin/env stack
-- stack --verbosity silent --resolver lts-3.8 --install-ghc runghc --package turtle --package filemanip --package optparse-applicative
module Main where
import Turtle
main :: IO ()
main = putStrLn "hello world"
```
But the above hello world takes up to 2 seconds to run on my laptop, even after the first run where the installs occur. Could we get a description of what the fundamental work to do in this scenario is? Which parts of it _must_ be slow, and which parts may have room for improvement?
For example, I would hope the fast path would basically say:
- is snapshot `lts-3.8` there already?
- are the requested packages installed already? (3 checks)
- go!
And it sounds like those should be `O(1)` operations, checking only on a few packages.
I'm guessing the current algorithm is more conservative, running some kind of `O(N)` sanity check over, e.g. all the transitive dependencies? If it's something like that, should we work on a fast or trusted mode where only the constant time checks are done?
Contributor guide
Assessment
This issue has not been assessed yet.