Open conal opened 10 years ago
I'd also love to hear what techniques people have for profiling (in a broad sense) and improving performance.
Do you mean performance of the transformations themselves (i.e. bash)? Or performance of HERMIT (i.e. running a large script)?
I guess I'd like to know how much time is spent on which transformations, with info about success rate. But really, I don't know what info would give me the insight I'm looking for about where time is spent and what I can do about it.
Hmmm, I haven't really thought about this yet.
I wonder if using the usual SCC pragmas on transformations and compiling with profiling would get anywhere? As always, I'm not sure how this works since we're trying to profile a compiler plugin. I think you'd have to compile GHC itself for profiling?
We could make a facility available to the monad to log events:
class MonadIO m => MonadEvent m where
logEvent :: String -> m ()
instance MonadEvent HermitM where
logEvent msg = ... log to a writer the msg and time ...
instance MonadEvent m => MonadEvent (Transform c m a) where
logEvent = constT . logEvent
-- semantically an identity, with side effect of logging start and end times
timeT :: MonadEvent m => String -> Transform c m a b -> Transform c m a b
timeT nm t = logEvent ("start " ++ nm) >> t >>= \r -> logEvent ("end " ++ nm) >> return r
Then you could take the event log and parse and accumulate cost centers. Something like that?
Does HERMIT have any support for gathering performance info? I'm struggling with performance but can only guess at what to tune.