3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-20 23:25:43 +01:00

Write a line where em shares a delimiter run with strong in time linear in its mark runs

This commit is contained in:
2026-10-30 20:39:09 +01:00
committed by Lillem4n
parent 01c8365f71
commit d0b2e22aa8
10 changed files with 64 additions and 26 deletions
+6 -2
View File
@@ -62,8 +62,12 @@
strong: text `un` beside `-r` marked em and strong, repeated 1000 times, took up to 9 seconds,
now under 170 ms, and `(` marked em, strike and strong beside a mention, repeated 1000 times,
took 18 seconds in `adfToPortableMarkdown`, now 150 ms. A line where em shares a delimiter run
with strong takes time quadratic in its length, as in `(` marked em and strong beside `(` marked
em, repeated.
with strong takes time linear in its length: ` ~~ ` marked em and strong, `)` marked em, strike
and strong, `a`, then `.unun` marked strike and strong, repeated 1000 times, took 33 seconds in
`adfToLosslessMarkdown` and 39 in `adfToPortableMarkdown`, now 2.6 and 1.5 seconds. A line whose
emphasis still reads back wrong after 32 tries is written with every node holding em, strike or
strong as `!adf:carry{json="…"}` in `adfToLosslessMarkdown`, and without those marks in
`adfToPortableMarkdown`.
- `adfToLosslessMarkdown` and `adfToPortableMarkdown` take time linear in the markdown when lists
and quotes nest deeply, and so does `losslessMarkdownToAdf`: a list nested 480 levels around
64 KB of paragraphs took 2 seconds to write, now 100 ms. A `!adf:blockquote` holding 2 MB of lines