3 ms·
No, It’s not possible to optimise Python like c++ because of the characteristics of the language. Plenty of very good people are working on Python optimisation
by tigershark 9y ago
No, It’s not possible to optimise Python like c++ because of the characteristics of the language.
Plenty of very good people are working on Python optimisation and it’s still painfully slow and will always be.
- duncan_bayne 9y agoPerhaps you should consider this a different way. Consider the end to end performance of a system - from inputs in (say, timesheets and HR data) to outputs out (bank payment APIs called, emails sent). Would you bet the end to end performance of a system built by mediocre C++ programmers would be better than that of a system built by mediocre Python programmers? I certainly wouldn't.
- duncan_bayne 9y agoTo elaborate a bit: what I mean is, it is easier to build an acceptably performant system in Python than in C++. Yes, an arbitrary algorithm will probably perform significantly faster in C++. But that probably won't matter in a real-world system built from multiple integrated components, when the performance is more likely to be determined by the abstractions chosen and the system architecture in use. And IMO Python and its surrounding ecosystem makes it easier to make good choices in those areas.
- jashmatthews 9y ago> Plenty of very good people are working on Python optimisation and it’s still painfully slow and will always be. Pypy etc never had the resources to build a truly amazing Python implementation. With Oracle throwing their weight behind Graal there's now ZipPy: http://thezhangwei.com/documents/oopsla113-zhang.pdf http://thezhangwei.com/documents/oopsla113-zhang.pdf Backwards compatibility with native extensions is the single biggest problem preventing optimising both Python and Ruby. If we could completely throw out C API compatibility like LuaJIT did, then we could make huge improvements to Python and Ruby performance and memory usage.
- collyw 9y agoI have been using Python for a while now, and its rarely that the language is too slow (I have encountered it on one problem). A lot of Python is for web programming where you optimize the database and set up caching to improve performance. If you want to do some heavy number crunching Numpy is apparently not far of C in terms of performance. Obviously its a case of the correct tool for the job and depends heavily on the type of software you are writing, but in most cases its a different type of optimization that is needed for Python code.
- igouy 9y ago> …too slow… No language implementation is "too slow" if performance doesn't matter. > … Numpy is apparently not far of C in terms of performance As-fast-as C when it is C (or Fortran or assembler…) :-)
- collyw 9y agoNumpy is a Python library, not a C library. By your reasoning Python is C.