In a 5-page document, Markdown 4.3.0 with the smartypants option takes ~140 ms in my application to render the document.
In v5.0.4, switching to the marked-smartypants extension, parsing now takes ~307 ms. I.e., more than half of the parsing time is spent inside this plugin. This makes live-editing a document very laggy.
Any ideas to speed this extension up? Performance profiling in Chrome show it is spending a lot of time in the educateQuotes() function, but in general the bulk of the processing is getting hung up on the many str = str.replace( functions:
Of the ~167 ms slowdown I see:
| function |
slowdown |
educateQuotes() |
106 ms |
educateDashesOldschool() |
10 ms |
educateBackticks() |
9 ms |
educateEllipses() |
11 ms |
ProcessEscapes() |
24 ms |
| other |
7 ms |
I realize this is just including the smartyPants package directly, so editing the code isn't really feasible, but it is so slow compared to the simpler Marked.js approach. With Marked.js 5 deprecating this feature natively, this extension is a bit overkill for the "high speed" goal of Marked.js.
Thoughts?
In a 5-page document, Markdown 4.3.0 with the smartypants option takes ~140 ms in my application to render the document.
In v5.0.4, switching to the
marked-smartypantsextension, parsing now takes ~307 ms. I.e., more than half of the parsing time is spent inside this plugin. This makes live-editing a document very laggy.Any ideas to speed this extension up? Performance profiling in Chrome show it is spending a lot of time in the
educateQuotes()function, but in general the bulk of the processing is getting hung up on the manystr = str.replace(functions:Of the ~167 ms slowdown I see:
educateQuotes()educateDashesOldschool()educateBackticks()educateEllipses()ProcessEscapes()I realize this is just including the
smartyPantspackage directly, so editing the code isn't really feasible, but it is so slow compared to the simpler Marked.js approach. With Marked.js 5 deprecating this feature natively, this extension is a bit overkill for the "high speed" goal of Marked.js.Thoughts?