Repository navigation
[lexical-y] Chore: Time the long remade line tests on the faster of two runs of each length - #9659
Conversation
…wo runs of each length ## Description `#9621: a long remade line stays linear` (from #9625) times one update per line length and compares 4,000 words with 1,000. The shape that makes every word move (past the exact diff's bound) took its first run of the bounded search at 4,000 words, so that run also paid for compiling the path: on a slower CI runner it measured 11.4 times the floor of the 1,000-word run and failed (`expected 11.44360849999939 to be less than 10`, core-tests / unit (24.x)). Each length now counts the faster of two runs, so a first run of a path or a collection does not count; the check is otherwise the same (linear is about 4x, quadratic 16x, the limit stays 10). ## Test plan ### Before One run per length (ms, small = 1,000 words, big = 4,000), on a development machine; the CI runner is slower: ``` LIN every word moved (made again in reverse, past the exact bound) 12.7 90.9 LIN every word moved (made again in reverse, past the exact bound) 13.2 100.5 ``` ### After The faster of two runs per length: ``` LIN changes at both ends 7.5 19.4 LIN a change every fourth word 9.2 27.7 LIN a word repeated between every two changed words 9.2 40.1 LIN every word moved (made again in reverse, past the exact bound) 16.4 24.6 LIN the white space between every two words, one node per word 58.2 200.1 $ vitest --run --project unit packages/lexical-y/src/__tests__/unit/regressions/RemadeTextStretches.test.ts -t 'stays linear' Tests 5 passed | 134 skipped (139) (6/6 runs passed while the rest of the @lexical/y suite ran beside it, load average 31) ```
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
lexical
@lexical/a11y
@lexical/clipboard
@lexical/code
@lexical/code-core
@lexical/code-prism
@lexical/code-shiki
@lexical/compiler
@lexical/devtools-core
@lexical/dragon
@lexical/eslint-plugin
@lexical/extension
@lexical/fast-check
@lexical/file
@lexical/hashtag
@lexical/headless
@lexical/history
@lexical/html
@lexical/internal
@lexical/link
@lexical/list
@lexical/mark
@lexical/markdown
@lexical/mdast
@lexical/offset
@lexical/overflow
@lexical/plain-text
@lexical/react
@lexical/rich-text
@lexical/selection
@lexical/table
@lexical/tailwind
@lexical/text
@lexical/utils
@lexical/y
@lexical/yjs
commit: |
There was a problem hiding this comment.
This change looks good.
Taking the faster of two runs per length targets the right cause. At 1,000 words a reversed line stays under EXACT_EDITS = 2048 (packages/lexical-y/src/internal/Inline.ts), so the 500- and 1,000-word runs never reach the fallback past the bound, and the first 4,000-word run used to pay for it. The second run at each length starts from a fresh document, so Math.min measures the same work with warm code.
The check also stays meaningful. With EXACT_EDITS raised so the 4,000-word reversed line runs the full exact diff, the updated test fails consistently at about 20x, against a limit of 10. Every timed run still asserts both peers' text after sync, and the change touches only tests, so no changeset is needed (AGENTS.md: tests need none).
No further suggestions.
## Description Merges main at c0c7e42 (#9640, #9600, #9652, #9659, #9648 and #9657). The one conflict is in the link list of `packages/lexical-y/DECISIONS.md`, where both sides added a reference (#9597 here, #9606 on main); both are kept. ## Test plan ### Before The branch was on main f59f74d. ### After `pnpm run ci-check` and `pnpm exec vitest run --project unit --project scripts-unit` pass on the merged tree (outputs in the pull request).
Description
#9621: a long remade line stays linear(from #9625) times one update per line length and compares 4,000 words with 1,000. The shape that makes every word move (past the exact diff's bound) took its first run of the bounded search at 4,000 words, so that run also paid for compiling the path: on a slower CI runner it measured 11.4 times the floor of the 1,000-word run and failed (expected 11.44360849999939 to be less than 10, core-tests / unit (24.x)). Each length now counts the faster of two runs, so a first run of a path or a collection does not count; the check is otherwise the same (linear is about 4x, quadratic 16x, the limit stays 10).Test plan
Before
One run per length (ms, small = 1,000 words, big = 4,000), on a development machine; the CI runner is slower:
After
The faster of two runs per length: