Performance/Strings
From HaskellWiki
(Difference between revisions)
(Packed strings are a performance-centric alternative to Strings) |
(Adding performance infobox for more nav options) |
||
| Line 1: | Line 1: | ||
| - | + | {{Performance infobox}} | |
| + | ==Strings== | ||
Sometimes the cost of representing strings as lists of ''Char'' can be | Sometimes the cost of representing strings as lists of ''Char'' can be | ||
Revision as of 19:03, 17 February 2006
| Haskell Performance Resource
Constructs: Techniques: |
Strings
Sometimes the cost of representing strings as lists of Char can be too much. In this case, you can instead use packed strings. There are a number of options:
* The standard Data.PackedString type * One of the newer packed string libraries, for example FastPackedString * Unboxed arrays of Word8 or Char * Ptrs to foreign malloced Word8 buffers
The packed string libraries have the benefit over arrays of Word8 or Char types, in that the provide the usual list-like operations.
