You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The differences between the different types of Writer monads are generally not too relevant to bytestring.
As far as the performance characteristics of the various bytestring types goes:
Concatenating many StrictByteStrings or ShortByteStrings with (<>) via any sort of writer monad is likely to be very inefficient except in niche situations.
Concatenating LazyByteStrings with (<>) can be efficient as long as the calls are generally right-associative. But if the individual LazyByteStrings are short, the result may have a small average chunk size, which may or may not be a problem depending on how that LazyByteString is used.
The codensity transform (or adding a ContT layer) can re-associate the monadic binds, if you have many nested calls that would tend to produce inefficient left-associative (<>) calls with a basic writer monad.
Concatenating Builders with (<>) is almost always at least reasonably efficient.
Thanks, I'm working on a biparsing package and I have not yet, if even possible, implemented printing a differing type than the type being parsed. I'll try to figure out how to allow parsing strict or lazy ByteString and printing Builder.
transformers
has three versions of WriterT (strict, lazy, CPS) and I am unsure how to best usebytestring
with these different writers.I am guessing that with
Builder
it would be best to use the strict or CPS version of WriterT.ByteString
lazy use strict or CPS version of WriterTByteString
strict andShortByteString
use the lazy version of WriterTAlso, which would allow an exception to be found most quickly?
If you have experience with this, especially with
Builder
, could you fill me in?The text was updated successfully, but these errors were encountered: