Skip to content

feat: add --stats flag for profiling#626

Open
no-yan wants to merge 14 commits intooxc-project:mainfrom
no-yan:feat/stats-flag
Open

feat: add --stats flag for profiling#626
no-yan wants to merge 14 commits intooxc-project:mainfrom
no-yan:feat/stats-flag

Conversation

@no-yan
Copy link
Copy Markdown
Collaborator

@no-yan no-yan commented Feb 5, 2026

Resolves #614

Some changes from the initial issue:

  1. Removed CPU time of typecheck, because we cannot get it without patching tsgo internals.
  2. removed wall time of lint, because rules run interleaved across files, and showing elapsed time is meaningless.
  3. Add "Traversal+overhead" in lint phase to detect non-rule overhead.

Implement note:

  • Measure worker CPU time to calc non-rule overhead.
  • Move nil checks inside metric functions to improve readability. Doing nil checks at the caller side made the code verbose. However, ruleListener keeps the check at the call site to minimize function calls, as it is a hot path.

Output

Typecheck:
    Program                                                  Wall Time     Files
    tsconfig.json                                               0.061s        16
    inferred program                                            0.012s         3
    ────────────────────────────────────────────────────────────────────────────
    Total                                                       0.072s

Lint:
    Rule                                                      CPU Time
    await-thenable                                              0.087s
    unbound-method                                              0.062s
    no-floating-promises                                        0.041s
    no-base-to-string                                           0.011s
    no-duplicate-type-constituents                              0.001s
    ... 6 more rules (0.000s)
    ──────────────────────────────────────────────────────────────────
    Traversal+overhead                                          0.002s
    Total                                                       0.205s

Summary:
    Category                                                 Wall time
    typecheck                                                   0.072s
    lint                                                        0.071s

@no-yan no-yan force-pushed the feat/stats-flag branch 2 times, most recently from 430a2bc to 4004925 Compare February 6, 2026 09:02
@no-yan no-yan changed the title add --stats flag for profiling feat: add --stats flag for profiling Feb 6, 2026
@no-yan no-yan marked this pull request as ready for review February 6, 2026 10:15
@camc314 camc314 self-assigned this Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add performance statistics report for bottleneck analysis

2 participants