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
node:assert
's assert.ok(false)
is really slow when using tsx
#548
Comments
I may be able to help debug and/or fix this issue, as I'm quite familiar with Node's and v8's stack traces APIs, but I'm not familiar at all with |
I can confirm that the error is also present in |
Thanks for the issue! Would you mind moving the reproduction into a repo that compares the speed between tsx and node using |
Here's the reproduction: https://github.com/alcuadrado/tsx-slow-assert-failure It runs it on github actions so that you don't need to install it. In this case, it runs 150 times slower, but we discovered this because of a real-life |
I boiled down the minimal reproduction further in https://github.com/privatenumber/node-bug-slow and reported it to Node.js: |
Acknowledgements
Minimal reproduction
(sorry it's inline)
Version
4.9.6
Node.js version
22.0.0
Package manager
pnpm
Operating system
Linux
Problem & expected behavior (under 200 words)
When running
node:assert
'sassert.ok(false)
withtsx
the automatic error message generation becomes notoriously slow.It seems to get slower the larger the file is, and the deeper the function that call's
assert.ok
is.I only tested this with an ESM package, running
node --import tsx/esm repro.ts
.It is not slow if I compile the file and run it without
tsx
.I have a strong belief that
tsx
is interfering with this function, making it really slow. As providing an error message toassert.ok
works around the performance issue.It should be approximately as fast as the compiled version.
No relevant stack traces.
No relevant documentation links.
No relevant screenshots.
Thanks for creating and maintaining this project.
Contributions
The text was updated successfully, but these errors were encountered: