bytebuild
Build byte arrays
https://github.com/byteverse/bytebuild
| LTS Haskell 24.16: | 0.3.16.3@rev:1 |
| Stackage Nightly 2025-10-24: | 0.3.16.3@rev:1 |
| Latest on Hackage: | 0.3.16.3@rev:1 |
bytebuild-0.3.16.3@sha256:cdae9435106134c0465d5e6411e6f54068d3e00dea8cc46abc4e28d44ab99849,4098Module documentation for 0.3.16.3
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.).
Changes
Revision history for bytebuild
Note: Prior to version 0.3.4.0, this library was named
small-bytearray-builder, not bytebuild. The library
small-bytearray-builder is now just a compatibility shim
to ease the migration process.
0.3.16.3
- Add support for building with GHC 9.10
0.3.16.2 – 2024-02-06
- Restore import statement for
liftA2to fix build for GHC 9.4.
0.3.16.1 – 2024-02-02
- Remove all CPP
- Drop support for GHC < 9.4
- Drop support for text < 2.0
0.3.16.0 – 2024-01-29
- Add
wordPaddedDec3. - Add
Data.Bytes.Builder.Avro. - Add
word16LEB128. - Stop accepting versions of text lower than 2.0.
0.3.15.0 – 2024-01-05
- Add
Data.Bytes.Builder.Unsafe.pasteUtf8TextJson#for users who need to perform JSON string encoding without using a builder. - Add
Data.Bytes.Builder.textJsonStringwhen building with text 2.0+
0.3.14.0 – 2023-07-20
- Add
runOntoLength. - Allow building with GHC 9.6.
0.3.13.0 – 2023-05-01
- Add VLQ builders for Word32 and Word64.
- Add chunks-to-builder function
- Add textUtf8 for copying text to builder with text-2.0 and newer
0.3.12.0 – 2022-12-01
- Support GHC 9.4.
0.3.11.0 – 2022-04-12
- Support GHC 9.2
- Inline pragmas for better LEB encoding perf
- Bump upper bound on tasty in test suite
0.3.10.0 – 2022-03-01
- Add upper bound on base since this does not build with GHC 9.2.
- Add
rebuild - Add
copyConsfor copying small byte sequences with extra byte in front - Use
zigzaglibrary from hackage - Seven eights encoding
- Finish out LEB for 32-bit and signed 32/64
0.3.9.0 – 2021-11-19
- Add
cstring# - Add
ToBuilderandToBoundedBuilderclasses - Add quasiquoter named
bldrinData.Bytes.Builder.Template.
0.3.8.0 – 2021-06-25
- Fix
doubleDec, which was encoding small numbers incorrectly. - Add
runByteStringfor producingByteStringfrom bounded builders. - Add
cstring#for producing builder fromAddr#. - Correct the required length calculation for json string encoding.
0.3.7.0 – 2020-11-06
- Fix build error in test suite.
- Add
ascii7andascii8. - Performance tweak for json string escape builder.
0.3.6.0 – 2020-06-30
- Add
replicate. - Fix compatibility with
primitive-0.7.1.0.
0.3.5.0 – 2020-05-01
- Add
wordLEB128andword64LEB128. - Add
integerDecandnaturalDec. - Add
word48PaddedLowerHex. - Add
newBuilderState,closeBuilderState,commitDistance, andcommitDistance1to the unsafe module.
0.3.4.0 – 2020-02-27
- Rename the library from
small-bytearray-buildertobytebuild, and move modules from theData.ByteArraynamespace to theData.Bytesnamespace. This is not considered a breaking change sincesmall-bytearray-buildercontinues to exist as a compatibility shim, reexporting the modules with their old names. - Add
wordPaddedDec4. - Add
reversedOntoandcommitsOntoChunks. - Add
ascii(2|3|4|5|6). - Add
cstringLenunbounded builder. - Add
copy2.
0.3.3.0 – 2020-02-10
- Add
word64PaddedLowerHexandword32PaddedLowerHex - Add
word256Array{LE,BE}andword256{LE,BE} - Add
word{128,256}Padded{Lower,Upper}Hex
0.3.2.0 – 2020-01-20
- Add
putMany, which allows pasting into the same mutable byte array over and over. - Add
consLength. - Add
putManyConsLength, useful for chunked HTTP encoding. - Add
runOnto - Add
Data.Bytes.Chunks.length - Add
wordPaddedDec2andwordPaddedDec9. - Add
word8PaddedLowerHex.
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. - Export
reverseCommitsOntoChunksfrom theUnsafemodule. - Add
SemigroupandMonoidinstances forChunks. - Add
consLengthLE32. - Add
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 frombytestring. 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. - Introduce
consLengthBE32andconsLength64BEfor efficient serialization of wire protocols that require prefixing a payload with its length. - Add
int{16,32,64}BEandint{16,32,64LE}as conveniences. - Add little-endian encoding functions for
Word16,Word32, andWord64. - Add big-endian and little-endian functions for copying a
PrimArrayof numbers (both signed and unsigned) into a builder. - Add
flush,copy, andinsertfor better control when converting byte sequences to builders. - Add
shortByteStringto improve interoperability with thebytestringlibrary.
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:
word16PaddedLowerHex,word16LowerHex,word16UpperHex,word8LowerHex. - Unroll loop for
word8Dec.
0.2.0.0 – 2019-09-04
- Use
natural-arithmeticto make manipulation of bounds possible. - Add more functions for encoding numbers. This includes
word8/16/32/64andint8/16/32/64. - Rename the modules.
- Correct a serious error in the implementation of
bytes. - Make
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