Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

Java vs. CPU and memory

Thread view: 
blackdog - 25 Jan 2006 15:41 GMT
Would anyone provide some information about Java with memory and CPU?

I would like to know whether Jave will consume huge amount of memory
and CPU on Sun Solaris 2.8 or Windows XP.

Your feedback will be appreciated.

Thanks.
Oliver Wong - 25 Jan 2006 19:13 GMT
> Would anyone provide some information about Java with memory and CPU?
>
> I would like to know whether Jave will consume huge amount of memory
> and CPU on Sun Solaris 2.8 or Windows XP.

   Probably not, for sufficiently large values of "huge".

> Your feedback will be appreciated.

   Your request is too vague.

   - Oliver
Daniel Dyer - 25 Jan 2006 19:17 GMT
> Would anyone provide some information about Java with memory and CPU?

Yes, Java requires both.

> I would like to know whether Jave will consume huge amount of memory
> and CPU on Sun Solaris 2.8 or Windows XP.

That depends entirely on what your program does.  However, Java programs  
do tend to have larger memory footprints than the equivalent native  
programs.  This is the overhead of loading and operating the Java virtual  
machine.  CPU usage is likely to be less of a problem, Java performance  
has improved considerably since the early days.  Most types of application  
work fine in Java, but without knowing what program you are talking about,  
its impossible to say how it is likely to perform.

Dan.

Signature

Daniel Dyer
http://www.dandyer.co.uk

blackdog - 25 Jan 2006 19:23 GMT
> > 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
Roedy Green - 25 Jan 2006 19:51 GMT
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.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.