Closed stroncium closed 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
@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