Suboptimal ToLogStr instance for Lazy ByteString
Closed this issue · 4 comments
andrewthad commented
The ToLogStr
instance for lazy bytestring converts the lazy bytestring to a strict bytestring. This is unnecessary since Data.ByteString.Builder.lazyByteString
pulls the chunks of a lazy bytestring straight into a builder.
chessai commented
I believe this is fixed in the most recent version
andrewthad commented
Nope, the instance still looks just like it does when I opened this issue:
instance ToLogStr BL.ByteString where
toLogStr = toLogStr . S8.concat . BL.toChunks
Preferable would be:
instance ToLogStr BL.ByteString where
toLogStr b = LogStr (fromIntegral (BL.length b)) (B.lazyByteString b)
chessai commented
@andrewthad i looked at the wrong instance. so nevermind then
kazu-yamamoto commented
@andrewthad Sorry, I didn't notice this. Could you send a PR?