Clarify compilation pipeline stages, partition thresholds, and build performance in documentation
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
- Tipo di issue
- Documentazione
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- documentation
Direzione di ricerca
The proposed changes are in docs/content/docs/how-it-works.mdx and docs/content/docs/cli.mdx. Read the existing LLVM backend and --optimization sections, then check that the documentation explains the 4 MiB threshold, serial compilation cases, frontend and backend work, and the dev build speed trade-off. The issue links open PR #1343, so the work is already underway.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
docs/content/docs/how-it-works.mdx notes that "Large executables… are divided into partitions that are optimized and compiled in parallel", but the public documentation does not describe the operational details of when and how compilation scales.
Developers and AI coding agents trying to optimize build times or understand CPU/core utilization in CI and local development frequently assume that compilation is parallelized across cores or wonder why builds run serially (~100–120% CPU) on typical inputs.
Key Operational Characteristics
Investigation of the compilation pipeline highlights several operational realities that would be valuable to document:
-
The 4 MiB Partition Threshold:
Partitioning is controlled bynativeProgramPartitions(packages/compiler/src/backend/native-codegen-core.ts), which requires textual LLVM IR to exceed 4 MiB (required < 2 → 1).- Small-to-medium programs (and synthetics with up to thousands of functions) typically emit < 4 MiB of LLVM IR and run through a single serial module in the backend.
- Non-executable emission (
--emit=asm,--emit=obj) and library builds (scriptc build --lib) never partition regardless of size.
-
Frontend vs Backend Distribution:
The compiler frontend (TypeScript parsing, type checking, typed IR lowering, and.lltext serialization) runs serially in Node.js/V8. For typical applications, the frontend dominates compilation wall time. Concurrency in the backend LLVM helper does not affect this stage. -
Automatic Backend Concurrency & Optimization Trade-offs:
When partitions do exist (> 4 MiB), the backend helper compiles them concurrently across the host's CPU cores automatically.dev(-O0): Designed for fast local iteration. Skips heavy optimization passes, and when partitions exist, compiles them independently with near-linear multi-core scaling.release(-O2): When an executable is small enough for a single partition, it imports precompiled runtime bitcode (--import-bitcode) to inline small runtime functions directly into application code. Executables large enough to be partitioned skip runtime bitcode inlining to bound build time and binary size, instead using ThinLTO summaries across partitions.
Proposed Documentation Updates
We can clarify these mechanics with surgical updates to existing documentation without adding new top-level pages:
-
In
docs/content/docs/how-it-works.mdx:- Clarify the 4 MiB LLVM IR threshold in step 3 ("LLVM backend") and state that smaller executables,
--emit=asm|obj, and--libcompile serially as a single partition. - Add a concise
### Build performance and scalingsubsection explaining frontend vs backend distribution,--optimization=devfor fast iteration, and release inlining trade-offs.
- Clarify the 4 MiB LLVM IR threshold in step 3 ("LLVM backend") and state that smaller executables,
-
In
docs/content/docs/cli.mdx:- Under
--optimization, emphasize thatdev(-O0) optimizes for build speed and fast iteration.
- Under
I have prepared a PR with these contained doc updates and will link it below.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 183
- Merge medio
- 2h 20m
- PR unite (30g)
- 893
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
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 vercel-labs/scriptc
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 20/100
vercel-labs/scriptc#1472 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
vercel-labs/scriptc#1437 ·
I maintainer di solito rispondono entro 1 giorno
-
node:tls: SNICallback, new tls.TLSSocket(socket, {isServer}), and ALPNProtocols not supportedAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
vercel-labs/scriptc#1438 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
vercel-labs/scriptc#1439 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 63/100
vercel-labs/scriptc#1440 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di vercel-labs/scriptc
Issue simili
-
area: repo priority: P2 type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
appandflow/stim#4107 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 1-3 ore Idoneità per principianti 60/100
lingdojo/kana-dojo#32859 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
code-quality refactoring
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
github/gh-aw-firewall#10364 ·
I maintainer di solito rispondono entro 1 giorno
-
Merge the duplicate kaffir_corn record into sorghumForse già presa @Crypto-Shroom l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
Crypto-Shroom/Bird-Feed-Calculator#322 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
drizzle-team/drizzle-orm#6552 ·
I maintainer di solito rispondono entro 2 giorni