Skip to content

[lexical-y] Chore: Time the long remade line tests on the faster of two runs of each length - #9659

Merged
zurfyx merged 1 commit into
mainfrom
zurfyx/remade-line-timing-best-of-two
Oct 31, 2026
Merged

zurfyx merged 1 commit into
mainfrom
zurfyx/remade-line-timing-best-of-two

Conversation

@zurfyx

@zurfyx zurfyx commented Oct 31, 2026

Copy link
Copy Markdown
Member

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)

…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)
```
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lexical Ready Ready Preview Oct 31, 2026 3:58am UTC
lexical-playground Ready Ready Preview Oct 31, 2026 3:58am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 31, 2026
@meta-code-review

meta-code-review Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 31, 2026, 4:08 AM UTC

@pkg-pr-new

pkg-pr-new Bot commented Oct 31, 2026

Copy link
Copy Markdown
lexical

npm i https://pkg.pr.new/lexical@9659

@lexical/a11y

npm i https://pkg.pr.new/@lexical/a11y@9659

@lexical/clipboard

npm i https://pkg.pr.new/@lexical/clipboard@9659

@lexical/code

npm i https://pkg.pr.new/@lexical/code@9659

@lexical/code-core

npm i https://pkg.pr.new/@lexical/code-core@9659

@lexical/code-prism

npm i https://pkg.pr.new/@lexical/code-prism@9659

@lexical/code-shiki

npm i https://pkg.pr.new/@lexical/code-shiki@9659

@lexical/compiler

npm i https://pkg.pr.new/@lexical/compiler@9659

@lexical/devtools-core

npm i https://pkg.pr.new/@lexical/devtools-core@9659

@lexical/dragon

npm i https://pkg.pr.new/@lexical/dragon@9659

@lexical/eslint-plugin

npm i https://pkg.pr.new/@lexical/eslint-plugin@9659

@lexical/extension

npm i https://pkg.pr.new/@lexical/extension@9659

@lexical/fast-check

npm i https://pkg.pr.new/@lexical/fast-check@9659

@lexical/file

npm i https://pkg.pr.new/@lexical/file@9659

@lexical/hashtag

npm i https://pkg.pr.new/@lexical/hashtag@9659

@lexical/headless

npm i https://pkg.pr.new/@lexical/headless@9659

@lexical/history

npm i https://pkg.pr.new/@lexical/history@9659

@lexical/html

npm i https://pkg.pr.new/@lexical/html@9659

@lexical/internal

npm i https://pkg.pr.new/@lexical/internal@9659

@lexical/link

npm i https://pkg.pr.new/@lexical/link@9659

@lexical/list

npm i https://pkg.pr.new/@lexical/list@9659

@lexical/mark

npm i https://pkg.pr.new/@lexical/mark@9659

@lexical/markdown

npm i https://pkg.pr.new/@lexical/markdown@9659

@lexical/mdast

npm i https://pkg.pr.new/@lexical/mdast@9659

@lexical/offset

npm i https://pkg.pr.new/@lexical/offset@9659

@lexical/overflow

npm i https://pkg.pr.new/@lexical/overflow@9659

@lexical/plain-text

npm i https://pkg.pr.new/@lexical/plain-text@9659

@lexical/react

npm i https://pkg.pr.new/@lexical/react@9659

@lexical/rich-text

npm i https://pkg.pr.new/@lexical/rich-text@9659

@lexical/selection

npm i https://pkg.pr.new/@lexical/selection@9659

@lexical/table

npm i https://pkg.pr.new/@lexical/table@9659

@lexical/tailwind

npm i https://pkg.pr.new/@lexical/tailwind@9659

@lexical/text

npm i https://pkg.pr.new/@lexical/text@9659

@lexical/utils

npm i https://pkg.pr.new/@lexical/utils@9659

@lexical/y

npm i https://pkg.pr.new/@lexical/y@9659

@lexical/yjs

npm i https://pkg.pr.new/@lexical/yjs@9659

commit: 549a7ca

@meta-code-review meta-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@zurfyx
zurfyx added this pull request to the merge queue Oct 31, 2026
Merged via the queue into main with commit bf0e14a Oct 31, 2026
58 of 59 checks passed
zurfyx added a commit that referenced this pull request Oct 31, 2026
## 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).

This branch was successfully deployed

2 active deployments
Preview – lexical — 549a7ca8 Deployed Oct 31, 2026 by vercel[bot]
Preview – lexical-playground — 549a7ca8 Deployed Oct 31, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant