This is similar to the builder facilities provided by
Data.ByteString.Builder. It is intended to be used in
situations where the following apply:
An individual entity will be serialized as a small number of bytes (less than 512).
A large number (more than 32) of entities will be serialized one after another without anything between them.
Unlike builders from the
bytestring package, these builders
do not track their state when they run out of space. A builder
that runs out of space simply aborts and is rerun at the beginning
of the next chunk. This strategy for building is suitable for most
CSVs and several line protocols (carbon, InfluxDB, etc.).
Revision history for bytebuild
Note: Prior to version 0.3.4.0, this library was named
bytebuild. The library
small-bytearray-builder is now just a compatibility shim
to ease the migration process.
0.3.4.0 – 2020-02-27
- Rename the library from
bytebuild, and move modules from the
Data.ByteArraynamespace to the
Data.Bytesnamespace. This is not considered a breaking change since
small-bytearray-buildercontinues to exist as a compatibility shim, reexporting the modules with their old names.
0.3.3.0 – 2020-02-10
0.3.2.0 – 2020-01-20
putMany, which allows pasting into the same mutable byte array over and over.
putManyConsLength, useful for chunked HTTP encoding.
0.3.1.0 – 2019-11-20
- Add big-endian and little-endian parsers for
Word128. This includes both the single and multiple element variants.
fromEffectto the unsafe interface.
0.3.0.0 – 2019-10-17
- Breaking change: Change the internal implementation of
Builder. This now works a lot more like the builder from
bytestring. It accumulates chunks and can do a zero-copy appends when working with a sufficiently large immutable chunk. This introduces a mild performance regression (around 10%), but it makes the libary more generally useful.
consLength64BEfor efficient serialization of wire protocols that require prefixing a payload with its length.
- Add little-endian encoding functions for
- Add big-endian and little-endian functions for copying a
PrimArrayof numbers (both signed and unsigned) into a builder.
insertfor better control when converting byte sequences to builders.
shortByteStringto improve interoperability with the
0.2.1.0 – 2019-09-05
- Stop exporting data constructor in
Data.ByteArray.Builder. This is technically a breaking change, but it was only exported by accident. So, with this release, we will technically violate PVP, and the previous release will be deprecated on hackage.
- Add more functions for encoding unsigned words:
- Unroll loop for
0.2.0.0 – 2019-09-04
natural-arithmeticto make manipulation of bounds possible.
- Add more functions for encoding numbers. This includes
- Rename the modules.
- Correct a serious error in the implementation of
pasteGrowSTaccept an initial offset.
- Add a
pasteGrowSTfor length-indexed builders.
- Add function for rendering floating-point numbers in a slightly inaccurate way.
- Add functions for encoding
ShortTextas UTF-8 and as a JSON string.
0.1.1.0 – 2019-07-30
- Add several additional functions for encoding numbers.
0.1.0.0 – 2019-06-25
- First version