Array package:text
Packed, unboxed, heap-resident arrays. Suitable for performance
critical use, both in terms of large data quantities and high speed.
This module is intended to be imported
qualified, to avoid
name clashes with
Prelude functions, e.g.
import qualified Data.Text.Array as A
The names in this module resemble those in the
Array family of
modules, but are shorter due to the assumption of qualified naming.
Mutable array type, for use in the ST monad.
For pinned byte arrays larger than 128KiB, this switches to the safe
FFI so that it does not prevent GC. This threshold (128KiB) was chosen
somewhat arbitrarily and may change in the future.
This uses the safe FFI. GC may run concurrently with
safe FFI calls. Consequently, unpinned objects may be
relocated while a safe FFI call is executing. The byte array
argument must be pinned, and the calling context is responsible
for enforcing this. If the byte array is not pinned, this function's
behavior is undefined.
This uses the unsafe FFI. GC waits for all unsafe
FFI calls to complete before starting. Consequently, an
unsafe FFI call does not run concurrently with GC and is not
interrupted by GC. Since relocation cannot happen concurrently with an
unsafe FFI call, it is safe to call this function with an
unpinned byte array argument. It is also safe to call this with a
pinned ByteArray argument.