bool array Type
Information
- Stores an array of
trueorfalse, but unlike[t.bool], it packs 8booleanvalues into 1 byte. This is especially efficient for storing large arrays ofboolean. - Requires 1 byte for every 8 values.
- Use
boolean[]for assignment.
Example Usage
import { Serializer, t } from "encodexx"
const serializer = new Serializer({ matrix: [t.boolArr],})
serializer.encode({ matrix: [ Array.from({ length: 1e7 }, () => Math.random() > 0.5), Array.from({ length: 1e7 }, () => Math.random() > 0.5), Array.from({ length: 1e7 }, () => Math.random() > 0.5), ],});Info
Unlike [t.bool], this encoding will take 8 times less space. For example, the above example takes 3,662 KB, while using [[t.bool]] would take 29,296 KB. In JSON format, such a matrix would take 161,000 KB.