Currently no option for ByteString based Templates #73

A1kmm opened this Issue Aug 1, 2012 · 3 comments

2 participants


Templates can only be made based on String; it would almost certainly be possible to get better performance by using a lazy bytestring or Text, and that performance would be useful when trying to maintain large websites with Hakyll.


I have some experience in this matter and I am convinced that this is not the main bottleneck for typical Hakyll sites. Pandoc usually takes up most time and gives us only a String type to work with.

Although, if you have a template-heavy site, I'd be glad to take a look at it and see if I can improve performance one way or another.


It may be that the site I'm working on is atypical, but part of it involves processing thousands of HTML files produced by Doxygen and applying a template consistent with the rest of the site to them. Pandoc is not involved in the process.

I have been time and heap profiling and found a number of issues:

  1. Issue #77 - due to using a list of all files.
  2. The in-memory cache was growing so large that it was making Hakyll swap out continuously and run very slowly. I have a more general solution to this issue which I am testing, but it is exacerbated by the use of String because heap profiling shows most of the memory held in the cache is in String form.
  3. Large proportions of time spent in String related functions - for example, in 'put' when serialising the String.

Because I don't use Pandoc for the Doxygen output (it is HTML already), I could in theory not have the data pass through String at all. I am going to attempt an alternative template implementation that uses ByteStrings and compare profiling results to see how it goes.


Okay, in that case it makes a lot of sense! Instead of using the simple templates that come with Hakyll, it might be worth looking at blaze-html (which Hakyll can also use).

@jaspervdj jaspervdj closed this Jul 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment