Daniel-Diaz / matrix

A Haskell native implementation of matrices and their operations.
BSD 3-Clause "New" or "Revised" License
35 stars 31 forks source link

does not finish compiling with profiling enabled #43

Open wrl314 opened 8 years ago

wrl314 commented 8 years ago

With both ghc 8.0.1 and ghc 7.10.2, compiling matrix with profiling enabled never finishes (or at least doesn't finish within 10 minutes or so).

To reproduce:

$ stack unpack matrix $ cd matrix-0.3.5.0 $ stack init $ stack build --profile

The non-profiled object file is built fine, but the profiled object file never finishes. ghc consuming 100% cpu until killed.

This is on a Mac running El Capitan.

Seems like this is a bug in GHC itself, but perhaps something in matrix is causing profiling to take exponential time? Any suggestions welcome.

wrl314 commented 8 years ago

The INLINE pragma on splitBlocks appears to be the culprit. Removing that inline allows profiling builds to finish.

wrl314 commented 8 years ago

So profiling builds do finish even without removing the splitBlocks inline pragma, but it took over an hour on an approx 1 year old Mac book pro.

Note that using stack build --profile --fast

works around the problem, but only when --fast comes after --profile. This disables inlining perhaps?

AndreasPK commented 6 years ago

Seems to be a GHC Bug. I will open a Ticket there.

In the meantime switching from -O2 to -O1 for profiled builds helps a lot. (I assume it's one of the things --fast changes).

But even then the performance is unreasonably bad.