<div dir="auto">I had a similar WTF moment when I noticed that Lucid's HtmlT over IO was 2x slower than HtmlT over Reader/Identity. Discussions over this mailing list pointed to the lack of INLINE pragmas on various functions, like >>=<div dir="auto"><br></div><div dir="auto">It was finally resolved via a liberal sprinkling of INLINE -- <a href="https://github.com/chrisdone/lucid/pull/67/files">https://github.com/chrisdone/lucid/pull/67/files</a> </div><div dir="auto"><br></div><div dir="auto">Why can't GHC automatically consider *every* function as INLINABLE? Let the GHC heuristics decide what is worthy of being inlined. What's the downside?</div><div dir="auto"><br></div><div dir="auto">-- Saurabh. </div></div><div class="gmail_extra"><br><div class="gmail_quote">On 3 Mar 2017 5:36 pm, "Matthew Pickering" <<a href="mailto:matthewtpickering@gmail.com">matthewtpickering@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I suspect this is because GHC will not specialise functions when used<br>
in other modules unless they are marked INLINABLE.<br>
<br>
Matt<br>
<br>
On Fri, Mar 3, 2017 at 11:40 AM, Joachim Breitner<br>
<<a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a>> wrote:<br>
> Hi,<br>
><br>
> Am Donnerstag, den 02.03.2017, 18:18 +0300 schrieb David Sorokin:<br>
>> I offer to define the functions of the Control.Category module<br>
>> inlinable:<br>
>><br>
>> -- | Right-to-left composition<br>
>> (<<<) :: Category cat => cat b c -> cat a b -> cat a c<br>
>> {-# INLINABLE (<<<) #-}<br>
>> (<<<) = (.)<br>
>><br>
>> -- | Left-to-right composition<br>
>> (>>>) :: Category cat => cat a b -> cat b c -> cat a c<br>
>> {-# INLINABLE (>>>) #-}<br>
>> f >>> g = g . f<br>
>><br>
>> Perhaps all functions from this module should be marked by this<br>
>> pragma as possible.<br>
><br>
> I am surprised that GHC does not consider these inlineable<br>
> automatically. Maybe it should? Would be worth investigating, if<br>
> someone is interested in some entry-level GHC hacking, why GHC does not<br>
> treat them as `INLINEABLE` in the first place. They are certainly small<br>
> enough, I would say…<br>
><br>
> Joachim<br>
><br>
> --<br>
> Joachim “nomeata” Breitner<br>
>   <a href="mailto:mail@joachim-breitner.de">mail@joachim-breitner.de</a> • <a href="https://www.joachim-breitner.de/" rel="noreferrer" target="_blank">https://www.joachim-breitner.<wbr>de/</a><br>
>   XMPP: <a href="mailto:nomeata@joachim-breitner.de">nomeata@joachim-breitner.de</a> • OpenPGP-Key: 0xF0FBF51F<br>
>   Debian Developer: <a href="mailto:nomeata@debian.org">nomeata@debian.org</a><br>
> ______________________________<wbr>_________________<br>
> Haskell-Cafe mailing list<br>
> To (un)subscribe, modify options or view archives go to:<br>
> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
> Only members subscribed via the mailman list are allowed to post.<br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div></div>