4 ms·
I hate to be that guy, but the key thing on my mind and the thing that constantly pushes me towards hybrid solutions: performance. Whats the verdict?
by henryl 14y ago
I hate to be that guy, but the key thing on my mind and the thing that constantly pushes me towards hybrid solutions: performance. Whats the verdict?
- gitarr 14y agoWell you don't get compilation to machine code with Python, but you won't get that with many languages. And the ones that do compile are often a pain to write in. So, I for one always go with "Always use the right tool for the problem at hand.", which means I use Python for most things and something like C for the few things that have to be faster. To answer your question: Python is fast enough for most things. It depends on how and what you are using it for though.
- scott_w 14y agoI don't know about the performance of Python 3.3; although I think that if performance is critical, then you should be looking at something other than Python (or a hybrid solution, as you say).
- dbaupp 14y agoThere a few options that allow you to stay (mostly) in Python: Numpy/Scipy for numerics; using Cython[0]; or using an alternative interpreter (specifically PyPy[1]). (This assumes that your specific use case is covered, e.g. PyPy doesn't support Python 3 yet.) [0]: http://www.cython.org/ http://www.cython.org/ [1]: http://pypy.org/ http://pypy.org/
- sho_hn 14y agoI can't answer you in the absolute, but FWIW, Python 3.3 contains a number of changes that are deep-seated enough to improve performance in a wide variety of applications. The biggest of these changes is likely the new adaptive system for the internal representation of strings which tries to pick a representation most suited to each respective string instead of using a "one size fits all" representation, to minimize the memory footprint and improve cache efficiency. Additional work that happened along side this should also greatly speed up encoding into UTF-8 and -16 and some string operations. Another biggie is the new dict implementation, which should also significantly reduce memory footprint and improve cache efficiency (and keep in mind that object attribute namespaces are dicts, so that also affects all objects).
- deleted 14y ago[deleted]
- obtu 14y agoThere are the improvements sho_hn mentions (string representation and shared dict keys to make objects more compact), but if you need more dramatic improvement, look to PyPy.