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
Move the interactive part of the CLI to a separate file #60
Move the interactive part of the CLI to a separate file #60
Conversation
I plan to fix the |
@sindresorhus Pushed wrong branch by accident. Tried to make a test against this, but Travis execution speeds are too unpredictable to make it work good, plus there was some unknown issue with pty not working correctly at all on some runs. If you have any pointers about writing such tests for node/travis, I could write one, but it seems like no one is testing such functionality. Anyhow, fixed the problems. |
👍 |
Moved all the code and requires handling interactive sessions to
cli-interactive.js
, leaving only arguments parsing and invoking fkill if possible incli.js
.Timed requires with
node --require time-require ./cli.js :8080
with process-to-kill on port 8080 on my dev machine(high speed nvme ssd, Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz).All values are rough averages of 5 runs, fs primed by running command another 5 times prior to test runs(and restarting process-to-kill), time between runs: roughly 5 seconds.
Didn't find any framework for such kind of tests, so just did it by hand.
before:
321ms
235ms
time-require
module:24ms
time-require
:297ms
time-require
:211ms
after:
194ms
108ms
time-require
module:24ms
time-require
:170ms
time-require
:84ms
effective require speedup: -60%, x2.5 times
effective total speedup: -43%, x1.75 times
Another possible speedup can be achieved by removing
meow
and usingminimist
directly:-33ms
to all metrics, bringing require speedup to -76%, x4.1 times, total speedup -54%, x2.1timesFixes #58