Re: [Haskell-cafe] mtlx has a nice design but is slow

2011-04-07 Thread Simon Peyton-Jones
GHC's goal is to be good enough at inlining and optimisation that you shouldn't 
take a performance hit for adding layers of abstraction.  Sometimes it needs 
help (eg inlining pragmas).  So as Don implies, it might be worth digging a bit 
to see where the performance hit comes from.

Simon

| -Original Message-
| From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-
| boun...@haskell.org] On Behalf Of Don Stewart
| Sent: 06 April 2011 18:19
| To: Sean Leather
| Cc: Haskell Café List
| Subject: Re: [Haskell-cafe] mtlx has a nice design but is slow
| 
| Is the package missing some obvious inlining in the instances?
| 
| On Wed, Apr 6, 2011 at 10:13 AM, Sean Leather  wrote:
| > I just refactored my type and transform system prototype (introduced in [1]
| > but changed since then) from using mtlx [2] (type-indexed monad
| transformers
| > described in [3]) to mtl using RWST. mtlx allowed me to cleanly separate
| the
| > various monadic components in a convenient way. Unfortunately, I found it
| to
| > be too slow. The refactoring was an experiment to see how slow. I was
| rather
| > surprised:
| >
| > Running time of a compiled main with a list of tests:
| >   mtlx (7 transformers): 2 min 52 sec
| >   mtl (RWST): 0 min 13 sec
| >
| > It's frustrating to see such a huge performance gap for a better design.
| >
| > Regards,
| > Sean
| >
| > [1]
| > http://splonderzoek.blogspot.com/2011/03/draft-type-changing-program-
| improvement.html
| > [2] http://hackage.haskell.org/package/mtlx
| > [3] http://www.ittc.ku.edu/~marks/cgi-bin/pubs/monadfactory.pdf
| >
| >
| > ___
| > Haskell-Cafe mailing list
| > Haskell-Cafe@haskell.org
| > http://www.haskell.org/mailman/listinfo/haskell-cafe
| >
| >
| 
| ___
| Haskell-Cafe mailing list
| Haskell-Cafe@haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mtlx has a nice design but is slow

2011-04-06 Thread Don Stewart
Typically you'll want to inline any definitions of >>= and return in
your classes and instances. Also, any non-recursive top level wrapper
functions.

On Wed, Apr 6, 2011 at 3:00 PM, Mark Snyder  wrote:
> I'm the author for mtlx, and admittedly I didn't do anything about
> efficiency when I implemented it.  Is there any initial place I ought to
> look for tips on inlining? I'll start with the pragmas page
> (http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/pragmas.html) I
> suppose.  I'm happy for any suggestions--optimizing hasn't been one of my
> focuses, so it's time for me to learn I suppose!
> I did switch to newtype definitions in the most recent version (0.1.5),
> which probably helped a lot compared to data definitions, but there are no
> inline pragmas in use, so perhaps there are some good opportunities for
> optimization.
> ~Mark Snyder
>>
>>Is the package missing some obvious inlining in the instances?
>>
>>> I just refactored my type and transform system prototype (introduced in
>>> [1]
>>> but changed since then) from using mtlx [2] (type-indexed monad
>>> transformers
>>> described in [3]) to mtl using RWST. mtlx allowed me to cleanly separate
>>> the
>>> various monadic components in a convenient way. Unfortunately, I found it
>>> to
>>> be too slow. The refactoring was an experiment to see how slow. I was
>>> rather
>>> surprised:
>>>
>>> Running time of a compiled main with a list of tests:
>>> ? mtlx (7 transformers): 2 min 52 sec
>>> ? mtl (RWST): 0 min 13 sec
>>>
>>> It's frustrating to see such a huge performance gap for a better design.
>>>
>>> Regards,
>>> Sean
>>>
>
>
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mtlx has a nice design but is slow

2011-04-06 Thread Mark Snyder
I'm the author for mtlx, and admittedly I didn't do anything about efficiency 
when I implemented it.  Is there any initial place I ought to look for tips on 
inlining? I'll start with the pragmas page 
(http://www.haskell.org/ghc/docs/7.0.3/html/users_guide/pragmas.html) I 
suppose.  I'm happy for any suggestions--optimizing hasn't been one of my 
focuses, so it's time for me to learn I suppose!

I did switch to newtype definitions in the most recent version (0.1.5), which 
probably helped a lot compared to data definitions, but there are no inline 
pragmas in use, so perhaps there are some good opportunities for optimization.

~Mark Snyder

>
>Is the package missing some obvious inlining in the instances?
>
>> I just refactored my type and transform system prototype (introduced in [1]
>> but changed since then) from using mtlx [2] (type-indexed monad transformers
>> described in [3]) to mtl using RWST. mtlx allowed me to cleanly separate the
>> various monadic components in a convenient way. Unfortunately, I found it to
>> be too slow. The refactoring was an experiment to see how slow. I was rather
>> surprised:
>>
>> Running time of a compiled main with a list of tests:
>> ? mtlx (7 transformers): 2 min 52 sec
>> ? mtl (RWST): 0 min 13 sec
>>
>> It's frustrating to see such a huge performance gap for a better design.
>>
>> Regards,
>> Sean
>>


  ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mtlx has a nice design but is slow

2011-04-06 Thread Don Stewart
Is the package missing some obvious inlining in the instances?

On Wed, Apr 6, 2011 at 10:13 AM, Sean Leather  wrote:
> I just refactored my type and transform system prototype (introduced in [1]
> but changed since then) from using mtlx [2] (type-indexed monad transformers
> described in [3]) to mtl using RWST. mtlx allowed me to cleanly separate the
> various monadic components in a convenient way. Unfortunately, I found it to
> be too slow. The refactoring was an experiment to see how slow. I was rather
> surprised:
>
> Running time of a compiled main with a list of tests:
>   mtlx (7 transformers): 2 min 52 sec
>   mtl (RWST): 0 min 13 sec
>
> It's frustrating to see such a huge performance gap for a better design.
>
> Regards,
> Sean
>
> [1]
> http://splonderzoek.blogspot.com/2011/03/draft-type-changing-program-improvement.html
> [2] http://hackage.haskell.org/package/mtlx
> [3] http://www.ittc.ku.edu/~marks/cgi-bin/pubs/monadfactory.pdf
>
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] mtlx has a nice design but is slow

2011-04-06 Thread Sean Leather
I just refactored my type and transform system prototype (introduced in [1]
but changed since then) from using mtlx [2] (type-indexed monad transformers
described in [3]) to mtl using RWST. mtlx allowed me to cleanly separate the
various monadic components in a convenient way. Unfortunately, I found it to
be too slow. The refactoring was an experiment to see how slow. I was rather
surprised:

Running time of a compiled main with a list of tests:
  mtlx (7 transformers): 2 min 52 sec
  mtl (RWST): 0 min 13 sec

It's frustrating to see such a huge performance gap for a better design.

Regards,
Sean

[1]
http://splonderzoek.blogspot.com/2011/03/draft-type-changing-program-improvement.html
[2] http://hackage.haskell.org/package/mtlx
[3] http://www.ittc.ku.edu/~marks/cgi-bin/pubs/monadfactory.pdf
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe