Node errors are very slow to create
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 399
- Forks
- 11
- Avg merge
- 29m
- Merged PRs (30d)
- 1
Description
Unfortunately, it's becoming increasingly common that errors are used as part of normal control flow.
AbortControllerthrows anAbortErroras part of cancellation logic.- A lot of web frameworks use throwing errors as part of request response logic using e.g. https://www.npmjs.com/package/http-errors. Hence, a normal 404 response can have nontrivial overhead due to to creating and throwing an error instead of simply doing
res.statusCode = 404; res.end(); return;. - Web specs use throwing errors as a normal flow control mechanism (e.g. WebStreams)
Hence the current state of constructing errors in Node is not optimal. The errors are heavily enriched with lots of helpful information, however at a huge performance cost. We need to investigate what can be done to improve this and discuss possible compromises.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by profiling the error-construction paths described in the issue, including AbortError cancellation, http-errors response handling, and WebStreams control flow. Compare their costs and document feasible improvements and the compromises required; done means the investigation has a clear, evidence-based direction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100