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
While debugging a performance issue I noticed that hPutSerialise ends up calling hPut on toLazyByteString . encode. As the comments on hPutBuilder note:
This function is more efficient than hPut . toLazyByteString because in many cases no buffer allocation has to be done. Moreover, the results of several executions of short Builders are concatenated in the Handles buffer, therefore avoiding unnecessary buffer flushes.
Thus I think it would be better to use hPutBuilder instead of hPut.
At the same time I noticed that writeFileSerialise calls withFile rather than withBinaryFile. I'm not sure what difference this makes, but it seems like the latter might be a better fit?
The text was updated successfully, but these errors were encountered:
I suspect that withBinaryFile won't make any difference as it (IIRC) only affects functions like System.IO.hPutStr which may need to encode. bytestring's put functions shouldn't encode. Nevertheless, it wouldn't hurt to use withBinaryFile for clarity.
While debugging a performance issue I noticed that
hPutSerialise
ends up callinghPut
ontoLazyByteString . encode
. As the comments onhPutBuilder
note:Thus I think it would be better to use
hPutBuilder
instead ofhPut
.At the same time I noticed that
writeFileSerialise
callswithFile
rather thanwithBinaryFile
. I'm not sure what difference this makes, but it seems like the latter might be a better fit?The text was updated successfully, but these errors were encountered: