axman6 / amazonka-s3-streaming

Provides a conduit based interface to uploading data to S3 using the Multipart API
MIT License
20 stars 23 forks source link

Avoid Builder #2

Closed axman6 closed 7 years ago

axman6 commented 7 years ago

It might be advantageous to avoid using ByteString Builder altogether. If we keep a list of chunks from the input, we don't need to worry about the Builder allocating buffers which are just going to be directly written to the network.


go buffsize digest = do
  mbs <- await
  case mbs of
    Just bs -> go (buffsize + length bs) (hash digest bs) ...
    Nothing -> send (uploadPart & <to use hashedBody because we know hash and size>)