[Haskell-cafe] Attoparsec.ByteString.Char8 or Attoparsec.ByteString for diff output?

Pedro B. pedroborg at gmail.com
Tue Feb 21 15:00:21 UTC 2023


Thanks a lot for your help!

Regards,

Pedro Borges

El 20/2/2023 a las 4:38 p. m., Viktor Dukhovni escribió:
> On Mon, Feb 20, 2023 at 03:58:10PM -0400, Pedro B. wrote:
> 
>> You made me realize that I can use "word8 _a" instead of  "char 'a'" and
>> almost have no need for the Char8 combinators. I'll probably do that and
>> only use  "decimal" from Char8 to parse integers, which I need to parse
>> line ranges such as "2,10".
> 
> That's the sort of thing I was hinting at.
> 
>> I still have a doubt though: given that I only match specific characters
>> generated by diff, do I gain something by not using Char8? Performance,
>> perhaps?
> 
> In most case performance gains are likely to be marginal at best.  The
> compiler should be able to optimise away most of the possible overhead
> of Char<->Word8 coversions, but perhaps in some corner cases you might
> see better performance.  Write maintainable code, and only if profiling
> shows opportunities for meaningful performance gains consider
> optimisations that might make the code less clear.
> 



More information about the Haskell-Cafe mailing list