This project exists purely for research purposes of determining the optimal way of building strict bytestrings. The ideas behind this project stem from a discussion on Reddit.
If you know any way of optimizing any particular benchmark or can suggest another benchmark subject, instead of complaining, PR without hesitation! This is intended to be a community project.
As of 2023-02-14. Using GHC 9.4 on an i5-10210U.
averagedAppends-1/byteStringStrictBuilder mean 129.5 ns ( +- 8.637 ns )
averagedAppends-1/byteStringTreeBuilder mean 162.8 ns ( +- 1.584 ns )
averagedAppends-1/fastBuilder mean 127.7 ns ( +- 875.5 ps )
averagedAppends-1/bufferBuilder mean 551.4 ns ( +- 9.334 ns )
averagedAppends-1/byteString mean 253.5 ns ( +- 4.361 ns )
averagedAppends-1/blazeBuilder mean 245.7 ns ( +- 3.974 ns )
averagedAppends-1/binary mean 280.0 ns ( +- 2.904 ns )
averagedAppends-1/cereal mean 282.1 ns ( +- 3.351 ns )
averagedAppends-1/mason mean 79.98 ns ( +- 481.1 ps )
averagedAppends-1/ptr-poker mean 108.6 ns ( +- 1.642 ns )
averagedAppends-100/byteStringStrictBuilder mean 9.690 μs ( +- 240.9 ns )
averagedAppends-100/byteStringTreeBuilder mean 14.11 μs ( +- 677.7 ns )
averagedAppends-100/fastBuilder mean 8.899 μs ( +- 237.5 ns )
averagedAppends-100/bufferBuilder mean 8.341 μs ( +- 152.1 ns )
averagedAppends-100/byteString mean 9.373 μs ( +- 107.8 ns )
averagedAppends-100/blazeBuilder mean 9.831 μs ( +- 112.7 ns )
averagedAppends-100/binary mean 12.15 μs ( +- 191.3 ns )
averagedAppends-100/cereal mean 12.70 μs ( +- 100.6 ns )
averagedAppends-100/mason mean 5.664 μs ( +- 45.78 ns )
averagedAppends-100/ptr-poker mean 7.581 μs ( +- 161.3 ns )
averagedAppends-10000/byteStringStrictBuilder mean 1.366 ms ( +- 19.45 μs )
averagedAppends-10000/byteStringTreeBuilder mean 2.022 ms ( +- 36.72 μs )
averagedAppends-10000/fastBuilder mean 903.5 μs ( +- 19.18 μs )
averagedAppends-10000/bufferBuilder mean 891.9 μs ( +- 33.72 μs )
averagedAppends-10000/byteString mean 948.1 μs ( +- 32.31 μs )
averagedAppends-10000/blazeBuilder mean 987.1 μs ( +- 43.89 μs )
averagedAppends-10000/binary mean 1.356 ms ( +- 18.20 μs )
averagedAppends-10000/cereal mean 1.563 ms ( +- 24.72 μs )
averagedAppends-10000/mason mean 531.0 μs ( +- 8.590 μs )
averagedAppends-10000/ptr-poker mean 891.7 μs ( +- 8.072 μs )
regularConcat-100/byteStringStrictBuilder mean 2.606 μs ( +- 22.30 ns )
regularConcat-100/byteStringTreeBuilder mean 1.808 μs ( +- 7.434 ns )
regularConcat-100/fastBuilder mean 1.203 μs ( +- 7.098 ns )
regularConcat-100/bufferBuilder mean 1.594 μs ( +- 20.56 ns )
regularConcat-100/byteString mean 705.0 ns ( +- 15.60 ns )
regularConcat-100/blazeBuilder mean 672.7 ns ( +- 5.802 ns )
regularConcat-100/binary mean 700.9 ns ( +- 8.295 ns )
regularConcat-100/cereal mean 2.514 μs ( +- 176.2 ns )
regularConcat-100/mason mean 859.9 ns ( +- 21.76 ns )
regularConcat-100/ptr-poker mean 2.498 μs ( +- 47.51 ns )
regularConcat-10000/byteStringStrictBuilder mean 360.0 μs ( +- 15.46 μs )
regularConcat-10000/byteStringTreeBuilder mean 260.8 μs ( +- 1.972 μs )
regularConcat-10000/fastBuilder mean 103.3 μs ( +- 1.152 μs )
regularConcat-10000/bufferBuilder mean 98.49 μs ( +- 276.4 ns )
regularConcat-10000/byteString mean 52.93 μs ( +- 597.5 ns )
regularConcat-10000/blazeBuilder mean 55.49 μs ( +- 245.0 ns )
regularConcat-10000/binary mean 54.40 μs ( +- 3.124 μs )
regularConcat-10000/cereal mean 214.8 μs ( +- 2.592 μs )
regularConcat-10000/mason mean 68.45 μs ( +- 980.7 ns )
regularConcat-10000/ptr-poker mean 351.4 μs ( +- 13.34 μs )