Yes, all substring-like operations on ByteString
s are O(1), as you can see in the documentation, and make a shallow copy with a different offset/length.
If you don't need this, use copy
to get a full copy of parsed results, so the original huge string could be garbage-collected.
Additionally, consider Lazy
incarnations of mmap
and Attoparsec
, it may probably be more optimal in case of a consecutive parsing of the large chunk.