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

TSX appears to be utilizing too much CPU #693

Open
4 of 6 tasks
npearson72 opened this issue Jan 21, 2025 · 0 comments
Open
4 of 6 tasks

TSX appears to be utilizing too much CPU #693

npearson72 opened this issue Jan 21, 2025 · 0 comments
Labels
bug Something isn't working pending triage

Comments

@npearson72
Copy link

npearson72 commented Jan 21, 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://github.com/expressjs/express

Problem & expected behavior (under 200 words)

  • What happened

I deployed a basic express app (hello world) using tsx and noticed CPU spikes. I then deployed the same app with ts-node and the spikes went away.

I then built a docker image and ran a benchmark with wrk: wrk -t12 -c400 -d30s http://localhost:3000/api

I had the following benchmark utils setup in the /api endpoint:

  console.log(process.memoryUsage());
  for (const [key, value] of Object.entries(process.memoryUsage())) {
    console.log(`Memory usage by ${key}, ${value / 1000000}MB `);
  }

  console.log(process.cpuUsage());
  • What I expected

I expected tsx to perform better than ts-node. But as you can see from the screenshots below, it unfortunately does not.

In my tests tsx is consuming 3x the CPU.

I'm very interested in using tsx and hope this is something that can be reasolved.

  • Screenshots

ts-node

Image

tsx

Image

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
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

1 participant