| 1 |
[](http://hackage.haskell.org/package/blaze-builder) |
| 2 |
[](https://stackage.org/nightly/package/blaze-builder) |
| 3 |
[](https://www.stackage.org/package/blaze-builder) |
| 4 |
[](https://github.com/blaze-builder/blaze-builder/actions) |
| 5 |
|
| 6 |
blaze-builder |
| 7 |
============= |
| 8 |
|
| 9 |
This library allows to efficiently serialize Haskell values to lazy bytestrings |
| 10 |
with a large average chunk size. The large average chunk size allows to make |
| 11 |
good use of cache prefetching in later processing steps (e.g. compression) and |
| 12 |
reduces the system call overhead when writing the resulting lazy bytestring to a |
| 13 |
file or sending it over the network. |
| 14 |
|
| 15 |
This library was inspired by the module `Data.Binary.Builder` provided by the |
| 16 |
`binary` package. It was originally developed with the specific needs of the |
| 17 |
`blaze-html` package in mind. Since then it has been restructured to serve as a |
| 18 |
drop-in replacement for `Data.Binary.Builder`, which it improves upon both in |
| 19 |
speed as well as expressivity. |
| 20 |
|
| 21 |
To see the improvements in speed, run the throughput benchmark, which measures |
| 22 |
serialization speeds for writing `Word8`, `Word16`, `Word32` and `Word64` in different |
| 23 |
endian formats and different chunk sizes, using the command |
| 24 |
``` |
| 25 |
make bench-throughput |
| 26 |
``` |
| 27 |
or run the list serialization comparison benchmark |
| 28 |
``` |
| 29 |
make bench-blaze-vs-binary |
| 30 |
``` |
| 31 |
Checkout the combinators in the module `Blaze.ByteString.Builder.Write` to see |
| 32 |
the improvements in expressivity. This module allows to incorporate efficient |
| 33 |
primitive buffer manipulations as parts of a builder. We use this facility |
| 34 |
in the `blaze-html` HTML templating library to allow for the efficient |
| 35 |
serialization of HTML escaped and UTF-8 encoded characters. |