Stack profiling defeating stream fusion

25 views
Skip to first unread message

John Ky

unread,
Nov 27, 2016, 5:48:54 PM11/27/16
to haskell-stack

Hello everyone,

I have this problem where enabling profiling using stack undoes stream fusion and I’d like to do my profiling with stream fusion intact.

The following reproduces my problem:

$ git clone g...@github.com:haskell-works/hw-tutorial-performance.git
$ cd hw-tutorial-performance/
$ stack init
$ stack build --executable-profiling
$ time $(find .stack-work/dist/ -type f -name hw-tutorial-performance-rwhe) 1e7
5000000.5

real    0m4.432s
user    0m3.484s
sys    0m0.936s

$ rm -rf .stack-work/
$ stack build
$ time $(find .stack-work/dist/ -type f -name hw-tutorial-performance-rwhe) 1e7
5000000.5

real    0m0.034s
user    0m0.018s
sys    0m0.013s

With profiling, my program taks over 4 seconds to run. Without profiling, it only takes 0.034 seconds.

I believe the problem to be that stream fusion has been disabled by stack.

Does anyone know how to prevent this from happening?

Cheers,

-John

Michael Snoyman

unread,
Nov 30, 2016, 12:19:12 PM11/30/16
to John Ky, haskell-stack
This isn't in any way a complete answer, but from within your project directory, you can use `stack exec -- ghc` to compile individual main modules, and play around with different profiling settings. My guess here is that -prof-auto it inserting cost centers in such a way that GHC isn't able to inline things, but that's very much a guess.

--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stac...@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-stack/238e95ac-d9f9-4569-88a3-eedd5ab9b2a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages