[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: following up on speed




> Well, I wasn't saying that it automatically manages the memory.  I was 
> only saying that someone
> programming in C++ with STL would not cobble together data structures 
> out of arrays and
> structs, but rather would use convenient STL classes, just as a Java 
> programmer would use
> Java library classes.  That's all I was saying.
> 

A few months ago, I read a fascniating study comparing languages. This
also ties in nicely with the language shoot out thread. A german
researcher gave the same non trivial programming assignement to coders
of c++, java, perl, python, tcl and a few others. He benchmarked and
compared the resulting programs. The bottom line is that the scripting
languages (python, perl, rexx, tcl) were developed in half the time
compared with java, c++, and c. C/C++ only demonstrated a factor of 2
speedup compred to Java and the scripting languages. Scripting language
implementations consumed twice as much memory as c/c++; java was another
factor of two away. 

The really weird thing is that the problem posed could be most easily
solved using associative arrays (hash tables, dictionaries), but none of
the C++ and java coders did so. Instead, they opted to manually build a
search tree which was takes a lot more work. In contrast, all of the
scripting language coders used their the language/library's hash table
implementation. Even though the java and C++ people had a perfectly good
hash table implementation available to them, they didn't use it; this is
not unusual in my experience. Can anyone comment if or why c/c++/java
folks are less likely to use library provided data structures rather
than rolling their own? I suspect it has something to do with a fixation
on micro optimization and constant factor improvements...

The study is available at
http://www.ipd.uka.de/~prechelt/documents/jccpp_tr.pdf


cheers,
Mike Salib