3
0
mirror of https://github.com/larvit/adf-codec.git synced 2026-11-12 11:48:29 +01:00

Answer prose round 1: 0 🔴, 4 🟡 (0 misread); retitle and rewrite the cap's entry, measure the changelog against 0.2.0

This commit is contained in:
2026-10-30 21:00:05 +01:00
committed by Lillem4n
parent 1f33007ae2
commit 6fd2e7ce07
3 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ In `docs/decisions.md`:
- No value `JSON.parse` or `structuredClone` builds loops a call
- Nothing spreads an unbounded array
- A retry loop checks its own termination
- A line reads back at most 32 times, then takes back every emphasis run
- After 32 passes, a line carries or drops every em, strike and strong mark
- Readers scan by index
- The spelling memo
- Cost fixes are measured, never timed
+4 -4
View File
@@ -62,10 +62,10 @@
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 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
with strong takes time linear in its length: `~~` between spaces marked em and strong, `)` marked
em, strike and strong, `a`, then `.unun` marked strike and strong, repeated 1000 times, took 56
seconds in `adfToLosslessMarkdown` and 130 in `adfToPortableMarkdown`, now 2.6 and 1.5 seconds. A
line still read 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
+11 -7
View File
@@ -908,17 +908,21 @@ fine.
A loop retrying an input until a fallback spells it refuses the pass taking no fallback, so its
termination is the loop's own check.
## A line reads back at most 32 times, then takes back every emphasis run
## After 32 passes, a line carries or drops every em, strike and strong mark
2026-10-30, the maintainer. Goals 9 and 1. Valid while a writer finds a misread run only by reading
the line back.
The lossless and portable writers read a line back after each fallback, and the sweep takes back
the misread pairs it can prove fall together. Where a strong opener captures the `*` em leaves over,
the sweep can't predict it, so one pass took back one strong, and a line of 1000 such repeats took
33 seconds. After 32 passes the line takes back every em, strong and strike run at once: the
lossless writer carries every node holding one, and the portable writer drops those marks. That
line keeps fewer marks than the pass-by-pass result would, in exchange for time linear in the line.
Each pass, the lossless and portable writers spell the line, read it back, and fall back on the
first misread emphasis run and on every run `unspellableRuns` proves falls with it: the lossless
writer carries the run's nodes, and the portable writer drops its mark. When em and strong share a
delimiter run, as in `***`, and the strong closes first, the next strong opener can pair with em's
leftover `*`. `unspellableRuns` can't foresee that pairing, so each pass falls back on one strong,
and a line repeating such a pattern 1000 times took 33 seconds lossless and 39 portable. After 32
passes, both writers fall back on every em, strike and strong run at once. Such a line keeps fewer
marks than one strong per pass would leave, and takes time linear in its length. 32 clears the
most passes any line in the suite needs, 22 portable and 5 lossless, with room to spare. The
`first` mode, which only a property uses, takes no cap.
## Readers scan by index