What startup time?
I even have a python script running on every shell prompt drawing (that checks mercurial on top of starting the python interpreter), and the latency is negligible.
What startup time?
I even have a python script running on every shell prompt drawing (that checks mercurial on top of starting the python interpreter), and the latency is negligible.
> time python manage.py --help
real 0m0.473s
user 0m0.240s
sys 0m0.148s
Half of a second is very noticeable (and annoying). I had similar perception in my previous work.You can try to only load enough to display the help text without really loading everything, but that doesn't work that well (you have to organize things differently, and `--help` requires to load a lot of stuff. `subcommand --help` needs less but it still has to see if the subcommand exists).
As a reference:
> time python -c 'print "hello"'
hello
real 0m0.041s
user 0m0.024s
sys 0m0.012s
> time echo hello
hello
real 0m0.000s
user 0m0.000s
sys 0m0.000s
Actually even the first (0.041s) is not instant, while the second one does (I mean as I perceive it visually). real 0m0.006s
user 0m0.000s
sys 0m0.004s $ time python -S -c 'print "Hello World!"'
...
real 0m0.007s
user 0m0.004s
sys 0m0.003s
That's about the same speed it takes my system's cp command to show me an error page: $ time cp -fail
...
real 0m0.005s
user 0m0.003s
sys 0m0.002sSadly, both pypy and python3 are slower than python2.7. Also worth nothing that the sys time fluctates for me -- in other words when it is > 0.00s it doesn't appear to have anything to do with the command run.
That's because it has to load django and the whole django project. Here's click:
> time python test.py --help
Usage: test.py [OPTIONS]
Options:
--help Show this message and exit.
python test.py --help 0.06s user 0.02s system 95% cpu 0.078 total
and argparse: > time python test.py --help
usage: test.py [-h]
optional arguments:
-h, --help show this help message and exit
python test.py --help 0.03s user 0.02s system 93% cpu 0.054 total
reference: > time python -c 'print "hello"'
hello
python -c 'print "hello"' 0.01s user 0.01s system 88% cpu 0.025 total