Further improve markdown compiler performance
Further improve markdown compiler performance

Stop using the markdown() convenience function in the
CompileMarkdown.compile_string() method, which creates a new Markdown
object each time it is called.

Instead, create a new class, ThreadLocalMarkdown, which is a subclass of
threading.local.  This class has a single attribute, markdown, which is
a per-thread Markdown instance.  It also has a single method, convert(),
which converts the data using the Markdown instance's convert() method,
and then resets the Markdown instance's internal state.

Then in the CompileMarkdown.set_site() method, instantiate a new
ThreadLocalMarkdown instance (unless the markdown module is unavailable)
and assign it to the plugin's converter attribute.  In the
compile_string() method, use that ThreadLocalMarkdown instance to
perform the conversion.

The end result is one Markdown object created per thread, instead of one
for each markdown file compiled.

getnikola/nikola,xuhdev/nikola,gwax/nikola,getnikola/nikola,okin/nikola,okin/nikola,getnikola/nikola,gwax/nikola,xuhdev/nikola,getnikola/nikola,xuhdev/nikola,gwax/nikola,xuhdev/nikola,okin/nikola,okin/nikola