Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 22462

Nikola: Markdown can affect performance

$
0
0

Markdown is a very popular input format for static site generators, that's why Nikola has supported it since very early in life, even if I prefer reSt most of the time.

One thing that has surprised me a while ago is that, considering how minimalistic markdown is, and how little it does, it can be pretty slow to process. But it turns out this is not completely markdown's fault, but that the python markdown implementation is really, really, really slow.

How slow? Let's check it out. All benchmarks in this post were done in my notebook, a nice Asus Zenbook UX305, with a fast SSD and plenty of RAM. In all cases the builds were done using no parallelization.

The test site is an empty site to which I added 1000 copies of a simple, not too large markdown file (our theming guide, converted from reSt using pandoc).

As a baseline, a site with 1000 copies of the original reSt theming.txt builds in 126 seconds.

The markdown version of that site? It gets progressively slower as files build, so I suspect it leaks something between builds, and finishes in ... 1584 seconds. That is over 12 times slower than the reSt compiler.

But you don't want to switch to reSt? No problem! We support more markdown compilers than we probably should, so you can just choose which one you prefer.

Here is a chart showing the performance of each (HTML and reSt added as reference):

#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f{-webkit-user-select:none;-webkit-font-smoothing:antialiased;font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .title{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:16px}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .legends .legend text{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:14px}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis text{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:10px}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis text.major{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:10px}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay text.value{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:16px}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay text.label{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:10px}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:14px}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f text.no_data{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:64px} #chart-498d5802-41ca-496c-a0d5-17d12a2beb8f{background-color:#f0f0f0}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f path,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f rect,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f circle{-webkit-transition:250ms ease-in;-moz-transition:250ms ease-in;transition:250ms ease-in}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .graph > .background{fill:#f0f0f0}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .plot > .background{fill:#f8f8f8}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .graph{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f text.no_data{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .title{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .legends .legend text{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .legends .legend:hover text{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis .line{stroke:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis .guide.line{stroke:rgba(0,0,0,0.6)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis .major.line{stroke:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis text.major{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.y .guides:hover .guide.line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .line-graph .axis.x .guides:hover .guide.line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .stackedline-graph .axis.x .guides:hover .guide.line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .xy-graph .axis.x .guides:hover .guide.line{stroke:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis .guides:hover text{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .reactive{fill-opacity:.5;stroke-opacity:.8}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .ci{stroke:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .reactive.active,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .active .reactive{fill-opacity:.9;stroke-opacity:.9;stroke-width:4}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .ci .reactive.active{stroke-width:1.5}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .series text{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip rect{fill:#f8f8f8;stroke:rgba(0,0,0,0.9);-webkit-transition:opacity 250ms ease-in;-moz-transition:opacity 250ms ease-in;transition:opacity 250ms ease-in}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip .label{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip .label{fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip .legend{font-size:.8em;fill:rgba(0,0,0,0.6)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip .x_label{font-size:.6em;fill:rgba(0,0,0,0.9)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip .xlink{font-size:.5em;text-decoration:underline}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip .value{font-size:1.5em}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .bound{font-size:.5em}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .max-value{font-size:.75em;fill:rgba(0,0,0,0.6)}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .map-element{fill:#f8f8f8;stroke:rgba(0,0,0,0.6) !important}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .map-element .reactive{fill-opacity:inherit;stroke-opacity:inherit}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-0,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-0 a:visited{stroke:#00b2f0;fill:#00b2f0}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-1,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-1 a:visited{stroke:#43d9be;fill:#43d9be}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-2,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-2 a:visited{stroke:#0662ab;fill:#0662ab}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-3,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-3 a:visited{stroke:#00668a;fill:#00668a}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-4,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-4 a:visited{stroke:#98eadb;fill:#98eadb}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-5,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-5 a:visited{stroke:#97d959;fill:#97d959}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-6,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-6 a:visited{stroke:#033861;fill:#033861}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-7,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-7 a:visited{stroke:#ffd541;fill:#ffd541}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-8,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .color-8 a:visited{stroke:#7dcf30;fill:#7dcf30}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-0 text{fill:black}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-1 text{fill:black}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-2 text{fill:black}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-3 text{fill:black}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-4 text{fill:black}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-5 text{fill:black}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-6 text{fill:black}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-7 text{fill:black}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .text-overlay .color-8 text{fill:black} #chart-498d5802-41ca-496c-a0d5-17d12a2beb8f text.no_data{text-anchor:middle}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .guide.line{fill:none}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .centered{text-anchor:middle}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .title{text-anchor:middle}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .legends .legend text{fill-opacity:1}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.x text{text-anchor:middle}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.x:not(.web) text[transform]{text-anchor:start}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.x:not(.web) text[transform].backwards{text-anchor:end}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.y text{text-anchor:end}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.y text[transform].backwards{text-anchor:start}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.y2 text{text-anchor:start}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.y2 text[transform].backwards{text-anchor:end}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis .guide.line{stroke-dasharray:4,4}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis .major.guide.line{stroke-dasharray:6,6}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .horizontal .axis.y .guide.line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .horizontal .axis.y2 .guide.line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .vertical .axis.x .guide.line{opacity:0}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .horizontal .axis.always_show .guide.line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .vertical .axis.always_show .guide.line{opacity:1 !important}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.y .guides:hover .guide.line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.y2 .guides:hover .guide.line,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis.x .guides:hover .guide.line{opacity:1}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .axis .guides:hover text{opacity:1}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .nofill{fill:none}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .subtle-fill{fill-opacity:.2}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .dot{stroke-width:1px;fill-opacity:1}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .dot.active{stroke-width:5px}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .dot.negative{fill:transparent}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f text,#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f tspan{stroke:none !important}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .series text.active{opacity:1}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip rect{fill-opacity:.95;stroke-width:.5}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .tooltip text{fill-opacity:1}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .showable{visibility:hidden}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .showable.shown{visibility:visible}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .gauge-background{fill:rgba(229,229,229,1);stroke:none}#chart-498d5802-41ca-496c-a0d5-17d12a2beb8f .bg-lines{stroke:#f0f0f0;stroke-width:2px}Seconds to build (bigger is worse)00100100200200300300400400500500600600700700800800900900100010001100110012001200130013001400140015001500158472.67350427350428267.00000000000006194127.80512820512821492.28773310023314126182.93675213675215503.3090034965035110238.06837606837607505.9022435897436564293.20000000000005513.357808857808934348.331623931624518.220134032634132403.46324786324783518.544289044289125458.5948717948718519.678831585081614513.7264957264957521.4616841491842Seconds to build (bigger is worse)markdownkramdownrestpandoccommonmarkmistunemistune+cythonmisakahtml

There are just a few disadvantages to using any of the alternative Markdown compilers:

  • They are less tested, because fewer people use them (and if you use them, that changes!)
  • They may lack a specific feature of the "standard" markdown compiler, such as extension support (in which case, file a bug with us!)
  • The produced output may differ from the "standard", but that happens :-)

Viewing all articles
Browse latest Browse all 22462

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>