Join GitHub today
Use Data.ByteString.Base16.encode. #646
I have a somewhat pages lookup-heavy site (lots of structure with autogenerated TOCs), and profiling shows
I guess the names of the cached data are changed with this modification, but that's a matter of
Hopefully you don't mind an additional dependency on base16-bytestring!
@0xd34df00d Thanks a lot for looking into this! I had no idea this was a problem. Can you try the following?
import Numeric (showHex) hash = toHex . ... where toHex :: [Word8] -> String toHex  = "" toHex (x : xs) | x < 16 = '0' : showHex x (toHex xs) | otherwise = showHex x (toHex xs)
I think that should remove a lot of allocations without requiring everyone to rebuild their site. If it doesn't help, I'm happy merging in your patch.
Hey @jaspervdj , sorry for taking so long to try out your suggestion! Indeed, it's improving things too quite a lot! The approach in my patch is just marginally faster (~0.5s on my site), so I'd be happy to go with your suggestion!
Would you do your change to upstream hakyll, or shall I issue another PR/update this one?