4 ms·
This is very impressive, and definitely more elegant than my approach. Getting make -j for free was definitely a major plus; before I started using a Python scr
by charlesdaniels 9y ago
This is very impressive, and definitely more elegant than my approach. Getting make -j for free was definitely a major plus; before I started using a Python script to syntax highlight inline code, my site built in under a second... now it takes around 3.
I am honestly surprised to find Python is so slow in terms of start up time. This made me wonder if it was generating / searching for .pyc files, but a quick test revealed this is not the case:
sh-4.3$ ls
nop.py nop.sh
sh-4.3$ hexdump -C nop.py
sh-4.3$ hexdump -C nop.sh
sh-4.3$ time python3 nop.py
real 0m0.064s
user 0m0.048s
sys 0m0.016s
sh-4.3$ time sh nop.sh
real 0m0.002s
user 0m0.002s
sys 0m0.000s
sh-4.3$ python3 -m compileall .
Listing '.'...
Compiling './nop.py'...
sh-4.3$ time python3 nop.py
real 0m0.062s
user 0m0.057s
sys 0m0.004s
sh-4.3$ python3 __pycache__/nop.cpython-35.pyc
sh-4.3$ time python3 __pycache__/nop.cpython-35.pyc
real 0m0.060s
user 0m0.048s
sys 0m0.012s
I would add that shell can be surprisingly fast for certain tasks when used correctly. It's very easy to write slow (ba)sh code though, so most shell scripts wind up being fairly non-performent.
Edit: formatting.