[Haskell-cafe] Is the #functional programming paradigm antithetical to efficient strings? #Haskell
David Fox
dsf at seereason.com
Mon Jul 11 22:22:41 UTC 2016
On Mon, Jul 11, 2016 at 2:09 PM, Bardur Arantsson <spam at scientician.net>
wrote:
> On 07/11/2016 02:54 PM, David Fox wrote:
> > On Sun, Jul 10, 2016 at 11:44 AM, KC <kc1956 at gmail.com
> > <mailto:kc1956 at gmail.com>> wrote:
> >
> > Is the #functional programming paradigm antithetical to efficient
> > strings? #Haskell
> >
> > I can certainly see how it might seem so. Our main string
> > representation uses about 10 times more memory than seems necessary,
> > and is relatively fast, though probably not compared to C. Recently I
> > spent some time looking into how to reduce this memory overhead, and I
> > modified the pretty library
> > (https://github.com/ddssff/pretty/tree/textdetails) so it could use any
> > type that was an instance of ListLike and StringLike
> > (https://github.com/JohnLato/listlike
> > <https://github..com/JohnLato/listlike>). Then I tried the UnitLargeDoc
> > test with several different data types. This just concatenates a list
> > of ten million "Hello" strings. Using String this happens in about 5
> > seconds. Using strict or lazy Text it immediately blew the stack. When
> > I increased the stack size to over 1GB it took minutes to complete.
> > When I used the Data.Text.Lazy.Builder type instead it took about 30
> > seconds to complete. Results with utf8 encoded ByteStrings were
> siimilar.
> >
>
> Did you try similar code on Java/C# (or whatever)?
I did not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160711/cb615dd9/attachment.html>
More information about the Haskell-Cafe
mailing list