Skip to content

Investigate making JSDoc parsing lazier and more optimal #52959

Closed
@DanielRosenwasser

Description

@DanielRosenwasser

Not parsing JSDoc seems to unlock significant parsing wins.

Surprisingly, we parse JSDoc unconditionally, even in .ts files for batch compilation.

So there are a few things I want to investigate here:

  1. Can we optimize JSDoc parsing itself? Why is JSDoc parsing so slow in the first place? Even if we decided to always parse JSDoc comments, it should be fast because full time-to-interactivity in the language service is bottle-necked on parse time.

    My naive theory is that JSDoc scanning today is "chatty", returning uninteresting tokens, making every request for the next token unnecessarily slow. But of course, this is without benchmarking. I would love to understand what exactly is the issue here.

  2. If it's not strictly required, can we make JSDoc parse in a lazier or optional fashion? It seems unavoidable in JavaScript files; but maybe in TypeScript files, JSDoc is only attempted to be attached in cases where we detect that trivia intersects with tag names we're interested in (e.g. @deprecated, @see, @link, maybe more). Maybe we only do this for the language service.

Metadata

Metadata

Labels

Domain: PerformanceReports of unusually slow behaviorExperimentA fork with an experimental idea which might not make it into master

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions