sindresorhus / fkill-cli

Fabulously kill processes. Cross-platform.
MIT License
6.88k stars 159 forks source link

Move the interactive part of the CLI to a separate file #60

Closed stroncium closed 5 years ago

stroncium commented 5 years ago

Moved all the code and requires handling interactive sessions to cli-interactive.js, leaving only arguments parsing and invoking fkill if possible in cli.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:

after:

effective require speedup: -60%, x2.5 times effective total speedup: -43%, x1.75 times

Another possible speedup can be achieved by removing meow and using minimist directly: -33ms to all metrics, bringing require speedup to -76%, x4.1 times, total speedup -54%, x2.1times


Fixes #58

sindresorhus commented 5 years ago

Another possible speedup can be achieved by removing meow and using minimist directly

I plan to fix the meow slowness in a different way: https://github.com/sindresorhus/meow/pull/107

stroncium commented 5 years ago

@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.

sindresorhus commented 5 years ago

👍