kazu-yamamoto / logger

A fast logging system for Haskell
159 stars 68 forks source link

Avoid unnecessary copy for Text values with text-2.0 #219

Closed alexbiehl closed 1 week ago

alexbiehl commented 2 weeks ago

Ever since text-2.0 counting the numer of bytes in a Text value is O(1). This allows us to construct a LogStr very efficiently without going through a ByteString (which uses pinned memory) first. Hurray!

Unfortunately this patch downgrades Safe Haskell Safe to Trustworthy for the LogStr module. I am sure how much of problem that is though.

kazu-yamamoto commented 1 week ago

This is awesome. Merged and released. Thank you for your contribution!