greghendershott / markdown

Markdown parser written in Racket.
101 stars 28 forks source link

Open HTML tag at start of a long file causes parser to take forever #49

Closed cesquivias closed 8 years ago

cesquivias commented 9 years ago

I wrote a long blog post using Frog and left an unclosed HTML tag towards the front of the file (<TODO>). When trying to convert the file to HTML the parser hung. It sent my CPU to 100% and didn't finish after 5 min. The memory usage was oscillating around 200MB so it appears to be doing a lot of backtracking.

This sounds related to issue #43 but wanted to provide an test case I came across.

greghendershott commented 9 years ago

Yes. I'm afraid this is the worst case for the parser. Some months ago I spent quite a lot of time working on that, and made it suck somewhat less, but it still sucks. When I have time I will take another look.

greghendershott commented 8 years ago

Although this is still a worst-case corner of the grammar, the worst case should be significantly faster as a result of #51. As a result I'm going to close this. However if you think the performance is still not good enough, please feel free to comment here and I'll re-open it.