-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
request is super slow to require #2261
Comments
+1 |
975ms in my node.js docker container (linux vm) |
It would be nice to see some actual tracing here so that we know for sure what is taking all this time, but my guess would be that it's because of the modularity and the number of dependencies we have. For electron, you could work around this by using Also, I'm curious if you are using npm 2 or 3. If it's npm 3 it may be taking longer because the dependency lookups have to go backwards from the deps back to the top level of the tree. |
My findings:
Didn't research further |
@molszanski interesting that lookups take that long, I wonder how much of the remaining time is file reading vs interpretation. |
Yeah, more research is required
|
On Windows here, |
on a constraint arm device request takes more than 1200ms to load (measured using https://github.com/henvic/require-time). Dependency Overview over time:
I guess I stick with v2.53 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is a general dependency issue. We have a lot of them, they are big. It's known. |
Description
const request = require('request')
takes 100 to 150ms to execute (on Linux). Whereas needle, a similar library, only takes 20 to 25ms. I haven't tested needle's require-time on Windows, but request's require-time clocked in at around 800ms on Windows 7, which is pretty ridiculous. The time to require a module may not be an issue for a lot of applications, but it is a concern for electron apps. For example, if I were to build an electron app that called some api, my app's startup time would take an automatic hit of around 100ms just to require in request (and even longer on Windows). Any delay longer than 100ms is felt by a user, so right of the bat, my application loses any chance at being perceived as fast.
I've been working around this by using node's archaic http module, but I'm at a point where its increasingly hard for me to escape request. It is so damn popular. Basically any npm module that talks to a server uses request under the hood and consequently inherits request's slow require-time.
Steps to Reproduce
Going Forward
Can we bring down request's require time (at least to needle's levels)?
The text was updated successfully, but these errors were encountered: