Closed dato closed 3 years ago
Ah, no. This is not good, because now the function is not idempotent. And parseMIMEMessage calls itself recursively, which makes it worse.
Data.Text used to have a lines' function that parsed CRLF correctly, but it was removed in https://github.com/bos/text/commit/6818295d1a72ae09756fa4b07bc2da289e730e6f.
The following would be idempotent:
normalizeCRLF = T.intercalate "\r\n" . T.lines'
Context: I was seeing very bad performance for mails with a couple attachments (not too big, mind you; 250 KiB in total):
By leveraging Data.Text’s own functions, the number of allocations drops dramatically:
The code I used was: