Predicting performance of mtl-style code? - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Saurabh Nanda

I'm always worried about perf when I'm writing mtl-style code, especially wrt Lucid because, early-on I discovered unexpected perf issues -

Are there any thumb-rules to get good perf out-of-the-box when writing mt-style code? i.e. without having to necessarily benchmark stuff (because benchmarking properly takes a considerable amount of time).

I started noticing some severe performance drop when combining Scotty's ActionT with Lucid's HtmlT. A little benchmarking produced the following:

One idea is to use inspection-testing to make sure there are no Monad dictionaries being passed in the optimized Core.

Georgi Lyubenov // googleson78

There is definitely some related reading here -

This is a proposal for adding primops for capturing slices of the RTS stack to improve the performance of algebraic effect systems, which require delimited continuations. Rendered
Georgi Lyubenov // googleson78

I think there was some ""conclusion"" (please don't quote me! :D) that you need some SPECIALISE pragmas (for mtl)

Georgi Lyubenov // googleson78

I'm pretty sure Alexis has written up a lot of stuff somewhere else too, but I can't find it (or maybe it's already covered in the proposal)