Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Haskell require all libraries to be profiling-enabled for profiling?

Q: Profile Haskell without installing installing profiling libraries for all dependencies
A: You can't. Just install them, what's the problem?

Why?

If I only want to profile my code, considering library calls as no-op for profiling, why can't it allow partial profiling? Enabling profling can be tricky if there are a lot of already installed dependencies. While less accurate, it should be easier.

like image 836
Vi. Avatar asked Nov 10 '22 22:11

Vi.


1 Answers

My understanding is that when you ask GHC to compile code for profiling, the binary interface to the code changes. (And also it gets linked against a different version of the RTS.) Since all code in the same program must have the same binary interface... well, that's why.

To avoid this, GHC would have to either support mixing different binary interfaces in the same program, or find a way to compile profiled code with the same interface as non-profiled code. I guess neither of these things is particularly trivial to do.

I do agree it's very annoying, though...

like image 189
MathematicalOrchid Avatar answered Nov 15 '22 06:11

MathematicalOrchid