
Signature
Daniel Dyer
http://www.dandyer.co.uk
> > Would anyone provide some information about Java with memory and CPU?
>
[quoted text clipped - 16 lines]
> Daniel Dyer
> http://www.dandyer.co.uk
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++?
Thanks
Raymond DeCampo - 25 Jan 2006 19:32 GMT
>>>Would anyone provide some information about Java with memory and CPU?
>>
[quoted text clipped - 21 lines]
> memory/CPU than
> C or C++?
Java, C and C++ are programming languages. The only memory they consume
is in programmers' heads.
Programs written using Java, C and C++ consume memory when run on a
computer. In general, it is difficult to say anything of substance
about the comparative memory usage of such programs. The choice of
programmer is much more important than the choice of language in this
regard.
Ray

Signature
This signature intentionally left blank.
Daniel Dyer - 25 Jan 2006 19:37 GMT
> 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++?
The short answer is yes.
The long answer is yes but, with a few exceptions, it probably doesn't
matter.
For some tasks it is even claimed that Java can exceed C++ performance in
long-running applications because the virtual machine is able to optimise
at runtime. And, of course, many applications are I/O bound, in which
case it really doesn't matter what language you use as it will not be the
limiting factor.
Do you have an existing Java program that you want to run? Or do you want
to write a Java program to accomplish some particular task?
Dan.

Signature
Daniel Dyer
http://www.dandyer.co.uk
Oliver Wong - 25 Jan 2006 20:26 GMT
> 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.lang.java.programmer/browse_frm/thread/81f800
895f31cdf1/cb5cfa858f8e09c5
- Oliver
On Wed, 25 Jan 2006 19:17:23 -0000, "Daniel Dyer"
<dan@dannospamformepleasedyer.co.uk> wrote, quoted or indirectly
quoted someone who said :
>> Would anyone provide some information about Java with memory and CPU?
>
>Yes, Java requires both.
and it depends on which JVM you use. Remember that there i the option
of AOT compiling too which is more parsimonious of RAM.
See http://mindprod.com/jgloss/aot.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.