Skip to content
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

Improve startup time #58

Closed
antonmedv opened this issue Nov 22, 2018 · 8 comments
Closed

Improve startup time #58

antonmedv opened this issue Nov 22, 2018 · 8 comments
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted

Comments

@antonmedv
Copy link

antonmedv commented Nov 22, 2018

Issuehunt badges

fkill takes about 150-300 ms to start up. Will be cool to see it under <100ms. (MacBook Pro 2016)

IssueHunt Summary

stroncium stroncium has been rewarded.

Sponsors (Total: $20.00)

Tips

@sindresorhus
Copy link
Owner

Yes, would be nice to improve the startup performance, but we're kinda limited by general Node.js and require performance...

What Node.js version? Do you mean the interactive UI $ fkill or non-interactive (with arguments) $ fkill foo?

@sindresorhus
Copy link
Owner

I added time-require to see what require's take up the most time at startup:

Start time: (2018-12-25 19:50:35 UTC) [treshold=1%]
 #  module                                                                   time  %
 1  chalk (node_modules/time-require/node_modules/chalk/index.js)             7ms  ▇ 1%
 2  locate-path (node_modules/locate-path/index.js)                           6ms  ▇ 1%
 3  find-up (node_modules/find-up/index.js)                                   8ms  ▇ 1%
 4  graceful-fs (node_modules/graceful-fs/graceful-fs.js)                     7ms  ▇ 1%
 5  load-json-file (node_modules/load-json-file/index.js)                    15ms  ▇▇ 3%
 6  read-pkg (node_modules/read-pkg/index.js)                                18ms  ▇▇▇ 3%
 7  read-pkg-up (node_modules/read-pkg-up/index.js)                          27ms  ▇▇▇▇ 5%
 8  loud-rejection (node_modules/loud-rejection/index.js)                     6ms  ▇ 1%
 9  validate-npm-package-license (node...ate-npm-package-license/index.js)    9ms  ▇▇ 2%
10  ./fixer (node_modules/normalize-package-data/lib/fixer.js)               21ms  ▇▇▇ 4%
11  normalize-package-data (node_modul...ze-package-data/lib/normalize.js)   24ms  ▇▇▇ 4%
12  meow (node_modules/meow/index.js)                                        71ms  ▇▇▇▇▇▇▇▇▇ 12%
13  ./lib/parse (node_modules/cross-spawn-async/lib/parse.js)                10ms  ▇▇ 2%
14  cross-spawn-async (node_modules/cross-spawn-async/index.js)              11ms  ▇▇ 2%
15  execa (node_modules/taskkill/node_modules/execa/index.js)                18ms  ▇▇▇ 3%
16  taskkill (node_modules/taskkill/index.js)                                20ms  ▇▇▇ 3%
17  ./lib/parse (node_modules/cross-spawn/lib/parse.js)                      11ms  ▇▇ 2%
18  cross-spawn (node_modules/cross-spawn/index.js)                          14ms  ▇▇ 2%
19  execa (node_modules/fkill/node_modules/execa/index.js)                   22ms  ▇▇▇ 4%
20  cross-spawn (node_modules/pid-from...ode_modules/cross-spawn/index.js)    6ms  ▇ 1%
21  execa (node_modules/pid-from-port/node_modules/execa/index.js)           10ms  ▇▇ 2%
22  pid-from-port (node_modules/pid-from-port/index.js)                      11ms  ▇▇ 2%
23  ./lib/_stream_readable.js (node_mo...e-stream/lib/_stream_readable.js)    9ms  ▇▇ 2%
24  readable-stream (node_modules/readable-stream/readable.js)               14ms  ▇▇ 2%
25  from2 (node_modules/from2/index.js)                                      15ms  ▇▇ 3%
26  into-stream (node_modules/into-stream/index.js)                          16ms  ▇▇ 3%
27  csv-parser (node_modules/csv-parser/index.js)                             9ms  ▇▇ 2%
28  neat-csv (node_modules/neat-csv/index.js)                                29ms  ▇▇▇▇ 5%
29  tasklist (node_modules/tasklist/index.js)                                32ms  ▇▇▇▇ 5%
30  ps-list (node_modules/process-exists/node_modules/ps-list/index.js)      34ms  ▇▇▇▇ 6%
31  process-exists (node_modules/process-exists/index.js)                    36ms  ▇▇▇▇▇ 6%
32  fkill (node_modules/fkill/index.js)                                      94ms  ▇▇▇▇▇▇▇▇▇▇▇ 16%
33  color-convert (node_modules/color-convert/index.js)                       7ms  ▇ 1%
34  ansi-styles (node_modules/ansi-styles/index.js)                           9ms  ▇▇ 2%
35  chalk (node_modules/chalk/index.js)                                      16ms  ▇▇ 3%
36  lodash (node_modules/lodash/lodash.js)                                   20ms  ▇▇▇ 3%
37  ./baseUI (node_modules/inquirer/lib/ui/baseUI.js)                        23ms  ▇▇▇ 4%
38  ./ui/bottom-bar (node_modules/inquirer/lib/ui/bottom-bar.js)             28ms  ▇▇▇▇ 5%
39  ../Subscriber (node_modules/rxjs/internal/Subscriber.js)                  9ms  ▇▇ 2%
40  ./util/canReportError (node_module.../internal/util/canReportError.js)   10ms  ▇▇ 2%
41  ./internal/Observable (node_modules/rxjs/internal/Observable.js)         14ms  ▇▇ 2%
42  ./internal/observable/ConnectableO...ervable/ConnectableObservable.js)    6ms  ▇ 1%
43  ./scheduler/queue (node_modules/rxjs/internal/scheduler/queue.js)         6ms  ▇ 1%
44  ./operators/observeOn (node_module.../internal/operators/observeOn.js)    8ms  ▇ 1%
45  ./internal/ReplaySubject (node_mod...s/rxjs/internal/ReplaySubject.js)   15ms  ▇▇ 3%
46  ../util/subscribeToResult (node_mo...ternal/util/subscribeToResult.js)    7ms  ▇ 1%
47  ./internal/observable/combineLates...rnal/observable/combineLatest.js)   10ms  ▇▇ 2%
48  ./from (node_modules/rxjs/internal/observable/from.js)                    6ms  ▇ 1%
49  ./internal/observable/concat (node...js/internal/observable/concat.js)    9ms  ▇▇ 2%
50  rxjs (node_modules/rxjs/index.js)                                        88ms  ▇▇▇▇▇▇▇▇▇▇▇ 15%
51  rxjs/operators (node_modules/rxjs/operators/index.js)                    98ms  ▇▇▇▇▇▇▇▇▇▇▇▇ 16%
52  ./ui/prompt (node_modules/inquirer/lib/ui/prompt.js)                    190ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 32%
53  ../utils/screen-manager (node_modu...irer/lib/utils/screen-manager.js)    9ms  ▇▇ 2%
54  ./base (node_modules/inquirer/lib/prompts/base.js)                       12ms  ▇▇ 2%
55  ./prompts/list (node_modules/inquirer/lib/prompts/list.js)               20ms  ▇▇▇ 3%
56  chardet (node_modules/chardet/index.js)                                  10ms  ▇▇ 2%
57  iconv-lite (node_modules/iconv-lite/lib/index.js)                         6ms  ▇ 1%
58  tmp (node_modules/tmp/lib/tmp.js)                                         7ms  ▇ 1%
59  external-editor (node_modules/external-editor/main/index.js)             29ms  ▇▇▇▇ 5%
60  ./prompts/editor (node_modules/inquirer/lib/prompts/editor.js)           30ms  ▇▇▇▇ 5%
61  inquirer (node_modules/inquirer/lib/inquirer.js)                        277ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 46%
Total require(): 1059
Total time: 599ms

@sindresorhus
Copy link
Owner

Could also consider using ncc.

@sindresorhus
Copy link
Owner

Help welcome with this :)

@antonmedv
Copy link
Author

On latest 10 node, cli with arguments. What about redusing unnecessary requires at start and do only when needed?

@sindresorhus
Copy link
Owner

Yeah, we could move the interactive UI stuff to a separate file and only initiate it when there are no CLI arguments.

@IssueHuntBot
Copy link

@IssueHunt has funded $20.00 to this issue. See it on IssueHunt

@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label May 10, 2019
@issuehunt-oss issuehunt-oss bot added 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt and removed 💵 Funded on Issuehunt This issue has been funded on Issuehunt labels May 30, 2019
@IssueHuntBot
Copy link

@sindresorhus has rewarded $18.00 to @stroncium. See it on IssueHunt

  • 💰 Total deposit: $20.00
  • 🎉 Repository reward(0%): $0.00
  • 🔧 Service fee(10%): $2.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🎁 Rewarded on Issuehunt This issue has been rewarded on Issuehunt help wanted
Projects
None yet
Development

No branches or pull requests

3 participants