From 41afec1ed898159e1df3bc1157768f2066dd85e5 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 1 Jul 2022 15:36:38 +0200 Subject: Make paragraphs really fast The approach that `micromark-js` takes is as follows: to parse a paragraph, check whether each line starts with something else. If it does, exit, otherwise continue. That is slow, because our actual flow parser does similar things: the work was being done twice. To fix this, this commit introduces parsing each line of a paragraph separately. And finally, when done with flow, combining adjacent paragraphs. This same mechanism is reused for setext headings. Additionally, this commit adds support for interrupting things (or not). E.g., HTML (flow, complete) cannot interrupt paragraphs. Definitions cannot interrupt paragraphs, and connect be interrupted either, but they can follow each other. --- readme.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index f7847dc..103b201 100644 --- a/readme.md +++ b/readme.md @@ -46,11 +46,6 @@ cargo doc --document-private-items ### Some major obstacles -- [ ] (8) Can paragraphs operate more performantly than checking whether other - flow constructs start a line, before exiting and actually attempting flow - constructs? -- [ ] (3) Interrupting: sometimes flow can or cannot start depending on the - previous construct (paragraph, definition) - [ ] (5) Containers: this will be rather messy, and depends a lot on how subtokenization is solved - [ ] (3) Concrete constructs: HTML or code (fenced) cannot be “pierced” into by @@ -132,7 +127,6 @@ cargo doc --document-private-items #### Parse -- [ ] (3) Interrupting (html flow complete, definition + code_indented) - [ ] (5) attention\ test (`character_reference`, `hard_break_escape`, `hard_break_trailing`, `heading_atx`, `heading_setext`, `html_flow`, `thematic_break`)\ @@ -274,3 +268,6 @@ important. - [x] (1) Parse initial and final space_or_tab of paragraphs (in string, text) - [x] (1) Refactor to clean and document `space_or_tab` - [x] (1) Refactor to clean and document `edit_map` +- [x] (8) Make paragraphs fast by merging them at the end, not checking whether + things interrupt them each line +- [x] (3) Add support for interrupting (or not) -- cgit