commercialhaskell / commercialhaskell/stack
--profile with optimizations
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
Building my application (`stack build`) and running a task takes ~ 21 seconds of CPU time.
```
real 0m14.873s
user 0m19.085s
sys 0m1.851s
```
At the same time, building the application with `--profile` (`stack build --profile`) and running the same task _without_ turning `+RTS -p` takes abnormal 2 minutes 30 seconds of CPU time.
```
real 2m20.302s
user 2m30.719s
sys 0m6.484s
```
So I must assume that during the profile build, some optimizations are turned off/don't fire, and some inlining is not performed due to `-fprof-auto`. Rerunning the test with `+RTS -p` results in a profile, which mostly consists of calls to functions `pure`, `alg`, `inj`, `>>=`, `fmap` from `fused-effects` package which I use for my application. All these calls take ~25% of the running time, should have been inlined, but instead appear in the profiling result and make it harder to understand performance of the application itself.
What I tried:
* `stack build --no-library-profiling --executable-profiling --ghc-options -fprof-late --ghc-options -fno-prof-auto --ghc-options -fno-prof-cafs --ghc-options -O2 --ghc-options -fllvm`
* `ghc-prof-options` in `package.yaml`
### Stack version
~~~text
stack --version
2.9.1 x86_64 hpack-0.35.2
ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.4.5
~~~
### Method of installation
* An unofficial package repository (Nix)
Contributor guide
Assessment
This issue has not been assessed yet.