Link to home
Start Free TrialLog in
Avatar of GustavoValdes
GustavoValdes

asked on

Java's execution speed

Hi:
   I'm new in the Java world, I'm still learning the basics about AWT and Swing. My question
is about the java speed, I've tried some shareware IDE's (included Java Forte) and all of them
are extremely slow.

   That's why I'm wondering if java is used for "real" applications or is just used to
make applets. And if some of you really use java to build applications, Is there any way to
make the execution of a .class or .jar file faster comperable to the speed of an executable build
in C++ or VB?
ASKER CERTIFIED SOLUTION
Avatar of msrikant
msrikant

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nevertheless, Java is used for "real" applications (I am involved in such a thing). It is not, at present obviously, suitable for applications that require top of the line performance. But that is not a requirement for all applications.
Avatar of msrikant
msrikant

Yes java is used in many real applications but most of them just hangs up. Let me give an example, I think u know about Applets in java. They literally run very slowly( I have written many programs in Applets in my course of study, similarly i have written many win32 applications. I find that win32 applications run much faster than the Applet programs). If I am wrong please correct me( please explain with examples).
Avatar of GustavoValdes

ASKER

msrikant,I undestand your explanation about the garbage collection (with a reference book in my hand of course), but what I really want to know is: Is there any way to make the execution faster? I've seen many bat files that start the execution of a java class with an assorted variety of command line parameters like -x32...? Are these parameters used to increase the performace of the program?
GustavoValdes,

referring to msrikant's comment

>>>>>
The objects are created dynamically on the heap. This dynamic allocation is a very time consuming process.

this time is a little bit more in Java as compared to C++ ,which is still slower compared with C.
The reason is that this new MyClass() request goes to the JVM which is implemented in C or C++ which does the actual allocation on the client Operating System through calls to C/C++. Remember Java is portable but the JVM is not.

>>>>>
C++ does allocate objects in the heap but does not perform any garbage collection.

C++ also allocates local objects on the Stack which is blindingly faster than the heap.
>>>>>Java is used for "real" applications (I am involved in such a thing). It is not, at present obviously, suitable for applications that require top of the line performance.

Very true ,spending $1000-2000 more on a hot shot PC is better than spending many more on a hot shot programmer,this is the statement by a hot shot head honcho,I forget but where

>>>>>Is there any way to make the execution faster?
(1)Compile it to native code
(2)Use Hot spot JVM
?
Increasing performance is a difficult task but I suppose it can be done by creating the min. number of objects that are required. One more thing String Comparision is one more thing that one can minimize to increase the performance.
      I don't have much knowledge of java's Execution speed but make it a point that java runs slower than C or C++.
Well I second imladris over here
:)
to mbormann,
      what does this "second imladris" mean.
imladris 's statement >>>
Nevertheless, Java is used for "real" applications (I am involved in such a thing).

is true and I am also working in such a application,also much of what you said abt Memory and speed is true but it is mostly applicable to Applets .and that is going as the Java platform matures faster than any Language in the past 40 years, I think that Sun can claim that they have made it a huge success. The speed differential of Java with C++ which was 20/30 a couple of years ago has dropped to less than 4 with all advances which are too numerous to mention here.

>>>Let me give an example, I think u know about Applets in java. They literally run very slowly.

This is not true for applications ,Server Side Java is running stronger than ever,that is the reason they are starting another New Topic at EE.
I have spent close to 15 months in Java and have used Applets very little,I can claim proudly that I don't know of everything related with GUI's that much.

But a person who is capable of designing ,coding & testing their own classes can easily and smoothly migrate to GUI's.

Whereas a person who is mostly used to inserting code which ur favourite IDE generates for you is going to find it very tough doing everything .

I also done some GUI stuff but by old fashioned typing ,no IDE stuff.
Hope u understood.
:)
yes i understand