4 ms·
Just on the python3/python2.7 speed... This one has always killed me on BeagleBones... `$ time python3 -c "print('hello')"` I have a handful of utility script
by bjt2n3904 4y ago
Just on the python3/python2.7 speed... This one has always killed me on BeagleBones...
`$ time python3 -c "print('hello')"`
I have a handful of utility scripts written in python, and the overhead of starting/stopping is just massive! (Sadly, I don't have one on hand to actually print a metric...)
- freediver 4y agoLuckily in most cases a python web app is 'served' so it does not have this start-up overhead.
- jcelerier 4y agoJust because 10000 companies are making some random webapps in python doesn't make the 10 local Python apps any less bothersome. This is literally what killed java for end-users.
- ptx 4y agoInterestingly, Java has been improving lately in this regard, thanks to cloud and container use-cases. There was a big regression with Java 9, but since then it's been getting better with each release. Numbers for "hello world" on my machine: Java 7: 43 ms Java 8: 29 ms Java 11: 34 ms Java 18: 22 ms Python 2.7: 6 ms Python 3.10: 12 ms Perl 5: 1 ms
- cozzyd 4y agoHere you go, on a BeagleBoneBlack: $ time python3 -c "print('hello')" hello real 0m0.223s user 0m0.148s sys 0m0.047s and, for the record: $ python3 bench.py python-speed v1.3 using python v3.7.3 string/mem: 46673.98 ms pi calc/math: 98650.32 ms regex: 38489.41 ms fibonnaci/stack: 30723.3 ms multiprocess: 75500.34 ms total: 290037.35 ms (lower is better) Might get a little better with some tweaking of performance governors / idle states enabled but, yeah...
- ptx 4y agoIf your script doesn't need any third-party modules, you can try running it with "python3 -S", which should make the startup significantly faster if there are a lot of modules installed. (Twice as fast on my machine. Running Python from a venv is also somewhat faster than running it directly, but not as fast as with "-S".)