From a start with the performance of Python
A few days ago a friend of mine used C + + to write a small program is mainly text, use the STL. In the past few days to see Python, using python today wrote a feature the same procedure. C + + run-time version of the program more than two seconds, and actually written by Python not even one second that is really amazing (performance difference may be a major factor with containers Python hash table is based on the map, the map STL is based on balanced binary tree). The procedures also vary greatly in size, the C + + program to more than 100, and only 30 write Python trip. I think that as such compute-intensive (as opposed to the IO-intensive) procedures using Python and Java virtual machine based on this language does not see the ratio C / C + + slow the number of such procedures might also faster, because virtual Machine can be optimized for better performance.
C + + language too powerful features, such powerful for some people (including me) has a fatal attraction in an attempt to master the language, not the other languages. Modern C + + OO development has been exceeded, and more inclined to use the generic template features to solve the problem, to provide better reusability. Of course, such reusability is the result of complicated, and I believe that not beautiful (for example, to declare a variable needs? Map
,? Int>? Result, and only in Python? Result ={}?).
The introduction of template is not very revolutionary thing, only to the static-type language to resolve some of their own insurmountable problems, but solutions to these problems a programme. Template element programming will not solve too many problems, but only changes in programming style. This dynamic typing Python language simply does not need template.
Dynamic typing language computing hardware in the past because of capacity constraints, and the static type of language has been compared to inferior status. Along with the development of hardware, dynamic typing development of the language will be getting better and better.
Tags: performance, Python








0 Comments to “From a start with the performance of Python”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.