Hello all<div><br></div><div>After reading the modules docs and some other discussions, I&#39;m still not sure what&#39;s the best choice of tools for my problem. I&#39;m looking at the scion server code base. At the moment, it&#39;s reading and writing on sockets using Lazy ByteStrings, then converting them to Haskell Strings using utf8-string. The Haskell Strings are then parsed as JSON using the JSon package. the response is in JSON, translated back with utf8-string to ByteStrings. </div>
<div>This is efficient for small strings, but as I&#39;m extending the API I have calls with much more data, and performance degrades significantly. Timings seem to point to the encoding of the String to UTF8.<br clear="all">
I have replaced JSon by AttoJson (there was also JSONb, which seems quite similar), which allows me to work solely with ByteStrings, bypassing the calls to utf8-string completely. Performance has improved noticeably. I&#39;m worried that I&#39;ve lost full UTF8 compatibility, though, haven&#39;t I? No double byte characters will work in that setup?</div>
<div>Is Data.Text an alternative? Can I use that everywhere, including for dealing with sockets (the API only mentions Handle). Should I use Data.ByteString.UTF8 everywhere, rewriting the JSON parser to deal with this instead of the Word8 ByteStrings?</div>
<div>In short, what&#39;s the fastest way to implement receiving/sending UTF8 text across sockets?</div><div><br></div><div>Thanks for any pointer,<br>-- <br>JP Moresmau<br><a href="http://jpmoresmau.blogspot.com/">http://jpmoresmau.blogspot.com/</a><br>

</div>