Re: [Haskell-cafe] Too much inlining on text package

On 3/16/12 12:22 PM, Aleksey Khudyakov wrote:
Disclaimer. I'm no expert in text internals.
Because it's told to do so. This is an unfortunate feature of stream fusion. It does eliminate intermediate data structures but it requires that everything is inlined.
There are ways of mitigating that, however. In particular, the standard style is to have things inline aggressively before stage 0 or 1, and then in the last stage to "inline" things back to an indirect call to the library. This is used ubiquitously in GHC's list fusion, and is essential for stream-fusion since the intermediate stream form is a pessimation when it can't partake in fusion. -- Live well, ~wren

On 17.03.2012 01:51, wren ng thornton wrote:
On 3/16/12 12:22 PM, Aleksey Khudyakov wrote:
Disclaimer. I'm no expert in text internals.
Because it's told to do so. This is an unfortunate feature of stream fusion. It does eliminate intermediate data structures but it requires that everything is inlined.
There are ways of mitigating that, however. In particular, the standard style is to have things inline aggressively before stage 0 or 1, and then in the last stage to "inline" things back to an indirect call to the library. This is used ubiquitously in GHC's list fusion, and is essential for stream-fusion since the intermediate stream form is a pessimation when it can't partake in fusion.
I've checked source. Many functions have RULES to remove unfused strings. pack however doesn't

I suggest you file a bug. :) https://github.com/bos/text/issues -- Johan

On Fri, Mar 16, 2012 at 3:48 PM, Aleksey Khudyakov
On 17.03.2012 02:24, Johan Tibell wrote:
I suggest you file a bug. :)
I'm way too lazy for that. Also I don't want to steal joy of reporting a bug from people who actually suffer from it
I meant "you" as in the collective "you who care about this," not you specifically. :)

On Sat, Mar 17, 2012 at 1:28 AM, Johan Tibell
On Fri, Mar 16, 2012 at 3:48 PM, Aleksey Khudyakov
wrote: On 17.03.2012 02:24, Johan Tibell wrote:
I suggest you file a bug. :)
I'm way too lazy for that. Also I don't want to steal joy of reporting a bug from people who actually suffer from it
I meant "you" as in the collective "you who care about this," not you specifically. :)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
OK, issue created: https://github.com/bos/text/issues/19 If anyone has concrete ideas on how to improve the situation, could you comment on Github and/or send it as a pull request? Michael

On Sun, Mar 18, 2012 at 12:02 AM, Michael Snoyman
OK, issue created: https://github.com/bos/text/issues/19
I fixed the too-much-inlining bughttps://github.com/bos/text/commit/2b2cb084c4689c06f1a7851ff8eb1e412eb02c1btonight. As a bonus, Text literals are now decoded straight from GHC's packed encoding, without an intermediate step through String. Generated code now looks like this at -O and above: $ ghc -O -ddump-simpl -c CS.hs CS.foo :: Data.Text.Internal.Text [GblId, ...] CS.foo = Data.Text.unpackCString# "x\NULy"

On Apr 8, 2012 8:47 AM, "Bryan O'Sullivan"
On Sun, Mar 18, 2012 at 12:02 AM, Michael Snoyman
wrote:
OK, issue created: https://github.com/bos/text/issues/19
I fixed the too-much-inlining bug tonight. As a bonus, Text literals are now decoded straight from GHC's packed encoding, without an intermediate step through String.
Generated code now looks like this at -O and above:
$ ghc -O -ddump-simpl -c CS.hs CS.foo :: Data.Text.Internal.Text [GblId, ...] CS.foo = Data.Text.unpackCString# "x\NULy"
This looks great Bryan, thank you! Michael

On Sun, Apr 8, 2012 at 2:47 AM, Bryan O'Sullivan
I fixed the too-much-inlining bug tonight. As a bonus, Text literals are now decoded straight from GHC's packed encoding, without an intermediate step through String.
Generated code now looks like this at -O and above:
$ ghc -O -ddump-simpl -c CS.hs CS.foo :: Data.Text.Internal.Text [GblId, ...] CS.foo = Data.Text.unpackCString# "x\NULy"
Very nice! =) Cheers, -- Felipe.
participants (6)
-
Aleksey Khudyakov
-
Bryan O'Sullivan
-
Felipe Almeida Lessa
-
Johan Tibell
-
Michael Snoyman
-
wren ng thornton