Skip to content

tsc -b no-op build ~5x slower in 7.1.0-beta (isContentMapperSupplementalBuildInfoPath scans every root per file) #64897

Closed

Description

🔎 Search Terms

tsc -b slow up to date, no-op build slow, tsbuildinfo slow 7.1, incremental slower 7.1, build mode up-to-date check performance, isContentMapperSupplementalBuildInfoPath

🕗 Version & Regression Information

  • This changed between versions 7.0.2 and 7.1.0-beta
  • This changed in commit or PR Content mappers typescript-go#4712 (content mappers), which added isContentMapperSupplementalBuildInfoPath. main still has the same code

⏯ Playground Link

n/a - needs tsc -b on a big incremental project

💻 Code

tsc -b . --incremental                                    # full build
tsc -b . --incremental --verbose --extendedDiagnostics    # again, nothing changed

🙁 Actual behavior

on our app (private, ~20.8k files in the program, most of them .d.ts under node_modules) the second run says Project 'tsconfig.json' is up to date, Files: 0, and still takes 4.7s wall / 7.4s user. 7.0.2 does the same no-op in 1.0s / 0.24s user.
median of 5 runs each: 1.28s on 7.0.2 vs 6.49s on 7.1.0-beta. a smaller service (~11k files) goes 0.82s -> 1.74s

cpu profile of the no-op run on 7.1.0-beta (--pprofDir, go tool pprof -top -cum):

   cum   cum%
 3.73s 49.01%  build.(*BuildTask).getUpToDateStatus
 2.14s 28.12%  runtime.gcBgMarkWorker.func2
 2.13s 27.99%  collections.(*OrderedMap[...]).Keys.func1
 2.12s 27.86%  build.isContentMapperSupplementalBuildInfoPath
 1.88s 24.70%  runtime.concatstring2

getUpToDateStatus calls isContentMapperSupplementalBuildInfoPath for every non-root file in buildInfo.FileInfos, and that ranges over all the roots building string(root)+"." each time - so files x roots string allocations, plus the GC work on top. none of our files are content mapper outputs and we don't use content mappers at all

https://github.com/microsoft/TypeScript/blob/v7.1-beta/tsc/internal/execute/build/buildtask.go#L494
https://github.com/microsoft/TypeScript/blob/v7.1-beta/tsc/internal/execute/build/buildtask.go#L623-L638

🙂 Expected behavior

a no-op build about as fast as on 7.0.2. maybe skip the check when no content mapper is configured, or build the root lookup once per project instead of scanning every root for every file

Additional information about the issue

  • macOS 27 arm64 (Apple M5 Pro, 18 cores), node 24.18.0
  • the machine was busy while measuring, but the gap held in every run
  • cold builds got a lot better in 7.1 btw - 30-35% faster and 20-28% less peak RSS on the same two projects
  • happy to share the pprof files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions