A few days ago, a friend wrote a small program with C , mainly to process text and used STL. Seeing Python in these few days, I wrote a function of the same function with Python today. The C version of the program runs more than 2 seconds, and it is not just a second in Python, it is really amazing (the main factors in performance difference may be Python's container based on the Hash table, while STL's MAP It is based on balance binary tree). The size of the program is also very different, and C has more than 100 rows, and only 30 lines written in Python. I think the program like this type of calculation intensive (relative is IO-intensive), the virtual machine based on the virtual machine, which is used in Python and Java, is slightly slower than the C / C , and may be faster, because virtual Machine can be optimally optimized. C language is too powerful, this power has a fatal appeal for some people (including me), and other languages don't want to master this language. Modern C has exceeded OO, more inclined to solve the problem with Generic features provided by templates to provide better reusability. Of course, the result of this reuse is complex, and I think it is not as beautiful (such as declaring a variable needs? MAP
, int>? result, and only in Python? Result = {}?).
The introduction of the template is not a very revolutionary thing, just to solve some problems that cannot be overcome in the static strong type language, just solve the problem of these issues. The meta-programming of the template cannot solve too many problems, just the style of programming. Python's dynamic type language does not require templates at all.
Dynamic Type Languages have been disadvantageous than in terms of hardware computing power. With the development of hardware, dynamic types will inevitably develop better.