Cache `accepts` Instance in Request Methods?
Open
enhancement
- Dominant language
- JavaScript
- Stars
- 69.5k
- Forks
- 25k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
The current implementation of the `req.accepts`, `req.acceptsEncodings`, and `req.acceptsEncoding` methods in _lib/request.js_ creates a new `accepts` instance for each call.
Am I correct to think that this can lead to redundant object creation and parsing overhead, especially in scenarios where these methods are called multiple times within the same request lifecycle?
If caching the `accepts` instance seems correct to reduce overhead and help with faster execution, I am willing to create PR and benchmark comparisons for this. However, since I have very little idea about the overall scenario I need a confirmation of _go_ / _no go_.
Contributor guide
Assessment
This issue has not been assessed yet.