nim-markdown
nim-markdown copied to clipboard
Improve the Performance of nim-markdown
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.
- [x] HtmlBlockParser.parse is very slow. It has nested loop runs which can be optimized. #52
- [x] 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.
- [x] remove bottleneck
since()
calls. #53 - [x] 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).