blackdog said:
Sorry for not being clear that the message I post.
I meant to say java compare with C or C++. Does Java consume more
memory/CPU than
C or C++?
I'm going to do a little Q and A session myself here to spead this thread up
a bit. The conclusion is that there is no easy answer.
Q: Do Java programs consume more memory/CPU than C/C++ programs?
A: Not nescessarily. There exists Java programs which consume less memory
and CPU power than C/C++ programs. "Hello World" written in Java, for
example, consumes less memory and CPU and Doom 3 written in C++.
Q: Will a Java program consume more memory/CPU than a C/C++ program which
does the same thing?
A: Not nescessarily. I could write a really crappy implementation of "Hello
World" in C++ that requirs 2 gigs of RAM and 3 teraops to run.
Q: If you take the source code a C/C++ program, and compile it using Java,
will the resulting Java program require more memory/CPU time than its C/C++
counterpart?
A: The source code for a C/C++ program probably will not compile with a Java
compiler.
Q: If you take a C/C++ source code program, translate it to Java, will the
resulting Java program require more memory/CPU time than its C/C++
counterpart?
A: Not nescessarily, as there isn't a one-to-one mapping between C/C++
source code and Java source code. I could do a really crappy job of
translating, as above.
Q: Take two similar programs; One written in C/C++, and one written in Java.
Which one will run faster?
A: See this thread:
http://groups.google.ca/group/comp...._frm/thread/81f800895f31cdf1/cb5cfa858f8e09c5
- Oliver