Slow startup for CLI?
krisskross opened this issue · comments
I'm trying out drip for a java CLI. The drip/client side is a only a UNIX socket sending command args to the server listener which respond to various commands. This makes the client part very thin since jar dependencies are packaged on the server. Hopefully this setup can be enough for bash auto completion as well.
However, when i run a test between drip and java they seem to perform equally fast? But maybe i'm missing or doing something wrong?
I have created a super-simple project that demonstrate the client/server functionality here: https://github.com/deephacks/drip-test
The tests can be run like this:
-
Start the listening side on /tmp/serv.sock
$ ./run drip server
-
Run the drip test
$ for i in {1..5}; do time ./run drip drip-msg; done
-
Run the drip test
$ for i in {1..5}; do time ./run java java-msg; done
Here's a sample run.
- Java
$ for i in {1..5}; do time ./run java java-msg; done
java-msg echoes
real 0m0.328s
user 0m0.592s
sys 0m0.016s
msg echoes
real 0m0.267s
user 0m0.484s
sys 0m0.032s
java-msg echoes
real 0m0.273s
user 0m0.516s
sys 0m0.024s
java-msg echoes
real 0m0.271s
user 0m0.536s
sys 0m0.020s
java-msg echoes
real 0m0.280s
user 0m0.556s
sys 0m0.016s
- Drip
$ for i in {1..5}; do time ./run drip drip-msg; done
drip-msg echoes
real 0m0.354s
user 0m0.604s
sys 0m0.032s
drip-msg echoes
real 0m0.332s
user 0m0.020s
sys 0m0.012s
drip-msg echoes
real 0m0.291s
user 0m0.020s
sys 0m0.008s
drip-msg echoes
real 0m0.285s
user 0m0.016s
sys 0m0.016s
drip-msg echoes
real 0m0.282s
user 0m0.020s
sys 0m0.008s
Cheers! Awesome project!
AFAIU it is caused by the fact that drip needs to execute your command and, at the same time, start another JVM process in the background, creating resource contention and causing the slowdown.