soasme / nim-markdown

A Beautiful Markdown Parser in the Nim World.

Home Page:https://www.soasme.com/nim-markdown/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve the Performance of nim-markdown

soasme opened this issue · comments

commented

This is an umbrella issue for tracking the efforts on improving the performance of nim-markdown.

Below are potential bottlenecks:

  • Use normal sequence, instead of doublylinkedlist for token sequence.
  • HtmlBlockParser.parse is very slow. It has nested loop runs which can be optimized. #52
  • Consume less memory/gc by assigning slices instead of string objects to tokens. #54, #55, #56
  • Pre-chop the string by lines, instead of ad-hoc splitLines.
  • Use kind: XXX, instead of object inheritance.
  • Ignore parsing content when an html comment is matched.
  • remove bottleneck since() calls. #53
  • remove bottleneck firstLine() & restLines() calls. #56

minor point related to #49: in the specific case of parsing html comments (<!-- ... -->), there is no need to parse the content inside (which I think it is currently happening).