@hackage / text-short

Memory-efficient representation of Unicode text strings

Latest0.1.6.1

About

Metadata

  • Last updated , by phadej
  • License BSD-3-Clause
  • Maintained by: hvr@gnu.org

  • Lottery factor: 2

Links

Installation

Tested Compilers

  1. 9.12.2
  2. 9.10.2
  3. 9.8.4
  4. 9.6.6
  5. 9.4.8
  6. 9.2.8
  7. 9.0.2
  8. 8.10.7
  9. 8.8.3
  10. 8.6.5

Package Flags

Use the -f option with cabal commands to enable flags

    asserts (off by default)

    Enable runtime-checks via assert

Readme

This package provides the ShortText type which is suitable for keeping many short strings in memory. This is similiar to how ShortByteString relates to ByteString.

The main difference between Text and ShortText is that ShortText doesn't support zero-copy slicing (thereby saving 2 words), and, compared to text-1.*, that it uses UTF-8 instead of UTF-16 internally. Consequently, the memory footprint of a (boxed) ShortText value is 4 words (2 words when unboxed) plus the length of the UTF-8 encoded payload.