Is Python overhyped (just like Java)?
Stuart D. Gathman
stuart at bmsi.com
Wed Apr 2 23:35:53 CEST 2003
On Sun, 30 Mar 2003 21:35:04 -0500, Garen Parham wrote:
> Stuart D. Gathman wrote:
>> 1) no "safe" mode with GC, where memory overwrites, leaks, and
>> corruption are impossible.
> Sure there is, though not part of the language proper, the Boehm GC
> works great.
That provides conservative GC, but overwrites and corruption are still a
>> 2) Compiler is slow - even on 2.6Ghz Xeon. Using header caching
>> compilers is complex. Extensive template use makes compiler slow - but
>> they are essential to make C++ programming as "safe" as possible.
> This part isn't any inherent property of the language. If your
> experience is based on using g++ I could understand why you'd think
> this. C++ is pretty difficult to parse though - but I've used plenty
> that are real fast; dmc++ being the fastest.
My experience is based on g++, bcc, and xlc (IBM).
> Some good info, but I think you're conflating C and C++ here. The
> double-free issue is a mostly C thing (unnecessary in C++). In C++ it's
> also common to use smart pointers or other library facilities to manage
I use the tools you mention extensively, and they are a great help, but do
not by any stretch prevent double free and other memory management issues.
You can try to be disciplined, but eventually you flub up and get
confused about which other object owns a given object. As a discipline,
you could avoid all object sharing, and thus let C++ destructors handle it
all - but this introduces serious performance problems (might as well use
python). I generally start out with no object sharing, then introduce
sharing for performance bottlenecks until it is fast enough. Each shared
object is a potential memory problem.
Using STL iterators helps avoid most buffer overruns, but again does not
make them impossible. The advantage of Java (and to a lesser extent
python) is that these things are enforced at the virtual machine level.
Smart pointers that do reference counting are slower than just using
Boehms collector for smaller objects.
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - Mozart background
song for the Microsoft "Where do you want to go from here?" commercial.
More information about the Python-list