[Haskell-cafe] Is the #functional programming paradigm antithetical to efficient strings? #Haskell
will.yager at gmail.com
Tue Jul 12 03:36:50 UTC 2016
You picked the single slowest way to do it. Please see
All times are on my Intel Atom Macbook. Compiled with -O3, no other options.
Using Lazy Bytestrings (either through the Builder interface or plain old
concatenation) is about 7-7.5 times faster than string concatenation so on
your computer it should take about 0.12 seconds. In other words, faster
This is my usual experience with lazy bytestrings; due to their
optimization for cache size, they are extremely fast with almost no effort.
They often out-perform "fast" array operations in C due to fusion and cache
I will note that if you want to do exactly what C does (often with only
slightly different assembly output), you can often achieve this with
unboxed vectors (mutable or immutable, depending on your application).
On Mon, Jul 11, 2016 at 10:24 PM, Richard A. O'Keefe <ok at cs.otago.ac.nz>
> Making a list of "Hello world" 10,000,000 times and then
> concatenating that list to produce a single String took
> 0.87 seconds (start program to end program) in Haskell.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe