Performance Characteristics
Bitstrings have some interesting performance properties:
- Creation: Fast, similar to binary creation
- Appending: Efficient when building up bitstrings sequentially
- Pattern matching: Very efficient, compiled to optimized VM instructions
- Conversion to bytes: Requires padding, which is a copy operation
In general, if your final output must be byte-aligned (as most I/O is), consider whether working in bitstrings throughout is necessary, or if you can work in bytes and only use bitstrings for specific sub-operations.