GHC Haskell performance of IPv4 address rendering
问题 I recently built a library for handling IPv4 address in haskell. I have written two functions to render an IPv4 address to Text and I am surprised that the naive approach outperforms the approach that I actually thought about. Here are the relevant pieces. First, there is the definition of IPv4: newtype IPv4 = IPv4 { getIPv4 :: Word32 } Next we have the IP address renderer that I expected to perform well: toDotDecimalText :: IPv4 -> Text toDotDecimalText = LText.toStrict . TBuilder.toLazyText