[Haskell-cafe] 1G strings in Haskell
Donald Bruce Stewart
dons at cse.unsw.edu.au
Thu Apr 20 02:26:14 EDT 2006
Can I manipulate 1G strings in Haskell?
Doing some stress testing of FPS, here are some results for 1G strings.
3.2Ghz box, 2G physical mem.
Size of input string: 1G
N.B. 2G of physical ram is not enough when trying to benchmark functions
that copy 1G strings around :)
Function Time in seconds
All O(1) functions:
O(n) , but answer found early on:
map toUpper 143.871
Failed due to memory exhaustion.
Almost made it though, just need a tad more ram than I had.
reverse ! -- copy
cons ! -- copy
snoc ! -- involves a copy
++ ! -- can't concat two 1G strings on this box
sort ? taking too long, but space was ok.
[Char] functions are much more costly.
pack ! -- constructing 1G [Char] is not ok.
Lesssons, you can play with 1G strings in Haskell. Having more than 2G
ram is useful though. Replacing higher order functions with hard coded
first order equivalents can help.
More information about the Haskell-Cafe