Turning on edit for a large File re-highlights it on the main thread (~1 s on 100,000 lines)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend, performance
Direzione di ricerca
Start with the render path named in the profile: FileRenderer.renderFile and renderFileWithHighlighter, plus the worker-pool branch that edit mode skips (see #1144). The updateRenderCache join on onDeferTokenize is a separate, smaller cost you can measure on its own. Done means the edit switch no longer blocks the main thread on a 100,000-line file, shown by a before-and-after profile; the existing render tests should still pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Turning on edit for a File with a large file re-highlights it synchronously on the main thread. On a 100,000-line TypeScript file, the switch into edit mode is one long task of about 1.0 s on a CI runner and 0.8–1.6 s on a loaded 8-core Linux box. Viewing the same file with edit off stays smooth because highlighting goes through the worker pool.
Seen on @pierre/[email protected] with WorkerPoolContextProvider and Virtualizer mounted. The same code is still in 1.6.3.
Repro
<WorkerPoolContextProvider …>
<Virtualizer>
<EditProvider createEditor={factory}>
<File file={{ name: 'big.ts', contents: hundredThousandLines }} edit={editing} options={{ … }} />
</EditProvider>
</Virtualizer>
</WorkerPoolContextProvider>
Render with editing = false, wait for the view, then set editing = true.
Where the time goes
CPU profile of the switch, longest task (about 1.4 s in that run):
React passive effect (useFileInstance → applyEdit → editor.edit)
→ File.render → FileRenderer.renderFile
→ renderFileWithHighlighter → shiki codeToTokens ~0.8 s
This looks like the same path as #1144: once an edit session is active, rendering skips the worker branch and highlights synchronously.
A smaller, separate cost: during background tokenizing, FileRenderer.updateRenderCache runs file.contents = lineCache.lines.join("") on every onDeferTokenize batch, even though re-highlighting does not change any line's text. On the same file, skipping the join when no line text changed cut updateRenderCache self time from about 4.1 s to 0.2 s across the session, though it did not shorten the entry task above.
Happy to share the .cpuprofile files.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 226
- Merge medio
- 1g 14h
- PR unite (30g)
- 53
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pierrecomputer/pierre
-
Bug: Missing aria fields in the search inputForse già presa @saurav-shakya l’ha presa 6 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
pierrecomputer/pierre#1242 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: Row decorations and git status aren't part of a row's accessible nameForse già presa @saurav-shakya l’ha presa 6 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pierrecomputer/pierre#1187 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
pierrecomputer/pierre#1284 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 54/100
pierrecomputer/pierre#1279 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: Text selection and copy break across the virtualization boundaryForse già presa @Son-Of-Zeus l’ha presa 6 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 22/100
pierrecomputer/pierre#1255 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pierrecomputer/pierre
Issue simili
-
area:tooling good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
interledger/publisher-tools#1007 ·
I maintainer di solito rispondono entro 1 giorno
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
databrickslabs/ontos#1420 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
vercel-labs/just-bash#756 ·
I maintainer di solito rispondono entro 1 giorno
-
area: ci good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
interledger/web-monetization-extension#1555 ·
I maintainer di solito rispondono entro 1 giorno
-
🐞 bug 🧐 unconfirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Tencent/tdesign-vue-next#7056 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno