Skip to content

3x more startup delay compared to esbuild+node #715

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

Open
4 of 6 tasks
j4k0xb opened this issue Apr 16, 2025 · 1 comment
Open
4 of 6 tasks

3x more startup delay compared to esbuild+node #715

j4k0xb opened this issue Apr 16, 2025 · 1 comment
Labels
bug Something isn't working pending triage

Comments

@j4k0xb
Copy link

j4k0xb commented Apr 16, 2025

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I understand this is a bug tracker and anything other than a proven bug will be closed
  • I understand this is a free project and relies on community contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://stackblitz.com/edit/node-w1u6nxz1?file=benchmark.sh&view=editor

Problem & expected behavior (under 200 words)

  • What happened: tsx has noticeable startup delay. StackBlitz: 2.48s, Linux: 0.143s
  • What I expected: be roughly as fast as esbuild + node combined. StackBlitz: 0.81s. Linux: 0.034s

After looking into it more, these lines are responsible for about ~50% of the total time:

module.register(
// Load new copy of loader so it can be registered multiple times
`./esm/index.mjs?${Date.now()}`,
{
parentURL: import.meta.url,
data: {
port: port2,
namespace: options?.namespace,
tsconfig: options?.tsconfig,
} satisfies InitializationOptions,
transferList: [port2],
},
);

Flamegraph (added --cpu-prof flag to run.ts):

flamegraph

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $10 for financial support
@j4k0xb j4k0xb added bug Something isn't working pending triage labels Apr 16, 2025
@dougg0k
Copy link

dougg0k commented May 28, 2025

Maybe tsx could add tsgo support, to make it faster. https://devblogs.microsoft.com/typescript/announcing-typescript-native-previews/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage
Projects
None yet
Development

No branches or pull requests

2 participants