Description
Sets and maps with 8-bit words for keys.
Description
This library provides variant of Data.Map
and Data.Set
from the containers
library where the key is specialized to Word8
. Internally, this uses a 256-bit bitmask for the presence of keys and a SmallArray
of values of keys that were present. For example, the map {2 => Z, 3 => B, 5 => X, 9 => A}
would be repsented in memory as:
Bitmask: 0011010001000000... (240 more zero bits)
Value Array: Z,B,X,A
This is optimized for reads. Lookup is O(1)
. Union is technically O(1)
but only because the universe of keys is finite. The current implementation always scans through all 256 bits of key space.