Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose tracing module to public API #57477

Open
6 tasks done
kwasimensah opened this issue Feb 22, 2024 · 3 comments
Open
6 tasks done

Expose tracing module to public API #57477

kwasimensah opened this issue Feb 22, 2024 · 3 comments
Labels
API Relates to the public API for TypeScript In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@kwasimensah
Copy link

πŸ” Search Terms

tracing API

βœ… Viability Checklist

⭐ Suggestion

Expose https://github.com/microsoft/TypeScript/blob/main/src/compiler/tracing.ts#L368 so that people using the compilerAPI can use the equivalent of --generateTrace to profile where typescript is spending it's time.

I wanted to see if this is something the Typescript team is interested in supporting. Happy to try and submit the PR myself if amenable to this.

πŸ“ƒ Motivating Example

When using the compiler API, we can't use the equivalent of --generateTrace to get in-depth information about where typescript is spending it's time

πŸ’» Use Cases

  1. What do you want to use this for?
    Using the compiler API programmatically with a custom CompilerHost that's trying to cache SourcefFiles between invocations (i.e. confirming some work I've been doing around Export SourceFileObject and friends Β #57073)
  2. What shortcomings exist with current approaches?
    Typescript already has an internal mechanism to collect these performance metrics and it would be great if programmatic access to this was allowed. In general it'd be great if we could do the equivalent of executeCommandLine with custom CompilerHost (including all the command line only options)
  3. What workarounds are you using in the meantime?
    I can locally edit typescript to expose these functions
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Feb 22, 2024
@DanielRosenwasser DanielRosenwasser added the API Relates to the public API for TypeScript label Feb 22, 2024
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Feb 22, 2024

Personally, I think this is probably fine as long as we rename the API to something less generic than startTracing.

@jakebailey
Copy link
Member

Yes, if we're going to export this, I definitely want to rework the API. It's sorta goofy right now.

@kwasimensah
Copy link
Author

If there's work that you want done to the API that's more than a name change, then I'd bow out of trying to implement this myself because I can't promise to have the time for a lot of back and forths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants