3 ms·
I assume when you say "Node" you mean NPM? Just spent a few minutes checking NPM's startup code. For a total run of ~234ms, it spends: ~50ms loading a version
by lucideer 5y ago
I assume when you say "Node" you mean NPM?
Just spent a few minutes checking NPM's startup code. For a total run of ~234ms, it spends:
~50ms loading a version-parsing lib, loading JSON metadata containing Node binary version and checking node binaries against some hard-coded compatibility data. Dum doesn't seem to do any such sanity checks, which may be fine if you manually ensure your environment is correctly setup.
~25ms initiating logging (& exception handling). This seems like it could be improved.
~40ms loading config & 2 external dependencies (`which` and `graceful-fs`) - not sure if the config is the reason for slowness. The dependencies bring functionality Dum doesn't seem to need as much as NPM does. I guess the load-perf of the dependencies could be improved, unless it's the config loading causing this.
~80ms checking for updates!!! Absolutely no need to do this on every run - this could be throttled somehow at the very least.
The remaining ~40ms is actually running the script
---
Update: After looking more closely, it appears the update checking code doesn't actually run every time - it's taking 80ms just to load that code (without doing the actual check - the check is cached)