The superbuffer package

[Tags:benchmark, bsd3, library, test]

Efficiently (both fast and memory efficient) build a bytestring from smaller chunks


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.3.1.0, 0.3.1.1
Dependencies base (>=4.8 && <5), bytestring (<0.11) [details]
License BSD3
Copyright 2016 - 2017 Alexander Thiemann <mail@athiemann.net>
Author Alexander Thiemann
Maintainer mail@athiemann.net
Category Web
Home page https://github.com/agrafix/superbuffer#readme
Uploaded Sun May 28 10:09:49 UTC 2017 by AlexanderThiemann
Distributions LTSHaskell:0.2.0.1, NixOS:0.3.1.1, Stackage:0.3.1.1, Tumbleweed:0.2.0.1
Downloads 287 total (79 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2017-05-28 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for superbuffer

Readme for superbuffer-0.3.1.1

Haskell SuperBuffer

CircleCI Hackage

The superbuffer packages was designed to efficiently build up bytestrings from IO actions producing smaller chunks. The goal was to reduce memory overhead as much as possible while still being as fast as possible. In our use case, it reduced total memory usage of the program from 350 MB (bytestring builder) to 50 MB (superbuffer). For speed see benchmarks below. Note that the speed heavily depends on a good choice of the initial buffer size. superbuffer outperforms or performs similar to the bytestring alternatives consistently. superbuffer outperforms buffer-builder.

Usage

{-# LANGUAGE OverloadedStrings #-}
module Example where

import Data.ByteString.SuperBuffer
import qualified Data.ByteString as BS

myBS :: IO BS.ByteString
myBS =
    -- note: performance of superbuffer heavily depends on a
    -- smart choice of the initial buffer size. Benchmark to
    -- find what suits your needs.
    withBuffer 1024 $ \buf ->
    do appendBuffer buf "Hello "
       appendBuffer buf "World!"

Benchmarks

See: Benchmarks for 0.3.0.0