View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Discussion Kalpit patel

I read this article Technical opinion: Comparing Java vs. C/C++ efficiency differences to interpersonal differences by Lutz Prechelt. The 40 program implementations investigated were created by graduate students during the course of a controlled experiment on a different question. There were about 24 programs written in Java, 11 in C++, and 5 in C. Each program was written by a single person. These programmers had an average of 8 years of programming experience and estimated that they had previously written an average of 100 KLOC each (median: 20 KLOC).

All programs were asked to implemented the same functionality, namely a conversion of telephone numbers into word strings. The program first loads a dictionary of 73,113 words into memory from a flat text file (one word per line, 93KB overall). Then it reads "telephone numbers" from another file, converts them one by one, and prints the results. The task of the program is to find a sequence of words such that the sequence of characters in these words exactly corresponds to the sequence of digits in the phone number. All possible solutions must be found and printed. The solutions were created word by word and if no word from the dictionary could be inserted at some point during that process, a single digit from the phone number could appear in the result at that position. Many phone numbers had no solution at all.

The programmers were asked to write as reliable a program as they could. Efficiency was less important. However, a runtime limit (not quantified to the programmers in advance) was imposed during the acceptance test and many programs failed to satisfy it on the first attempt and had to be optimized before they were accepted. All 40 programmers found that writing the program took between 3 and 63 work hours (median: 10 hours, mean: 14 hours) and the resulting program had between 107 and 614 lines (median: 244 lines, mean: 277 lines, excluding comments).

All measurements presented were taken on a Sun Ultra 1 Unix workstation with 192MB main memory running the SunOS 5.5.1 (Solaris 2.5) operating system. The C/C++ programs were compiled with the GNU gcc/g++ compiler version 2.7.2, the Java programs ran under Sun's Java development kit (JDK) 1.2 reference implementation with a just-in-time compiler (JIT). The execution of the JIT is embedded in the execution of the program, hence all data presented includes the time or memory consumed by the JIT compilation.

The results were the average memory requirement of the java programs is two to three times larger then that of c or c++ prgorams. The bad/good ration was about 3.7 for the c/c++ programs and 1.7 for java programs.

The median runtime of the Java programs is over three times that of the C/C++ programs.
The three fastest Java programs are about twice as fast as the median C/C++ program and 10 times slower than the three fastest C/C++ programs.
The runtime, bad/good ratio is 32 for C/C++ and 37 for Java. This high variability stems from rather huge differences in the actual search routines: The load time bad/good ratio is only 3 for C/C++ and 5 for Java, but the processing time bad/good ratio is as high as 153 for C/C++ and 71 for Java.

as we see here java takes more memory is lot slower in the the runtime processing time, this is a very big limitation on the java side when it comes to day to day applications. Most of the networking and gaming programers use c++ or C as there first choise because when the speed matters java is just too slow to work with. This article is from the view point of a runtime processing. if we were to think about it fromt he web development point of a view Java is a great choise. Java is full of features that help make programers life eassy.

i read R. Steven French discussion on his article "An empirical comparison of C, C++, Java, Perl, Python, Rexx,
and TCL for a search/string-processing program" both mine and his article goes to support that c/c++ family of languages tend to be faster then java and few other scripting languages. i personally think at the end it come's down the to user's and programers choise of language. the speed stability and securtiy of a software is only as good as programers skills to design and code. i have seen people compare java and c/C++ software all the time, but i think the main diffrence in the results is when the software is using a lot of threds.

Links to this Page