File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes Regarding execution of java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Regarding execution of java code" Watch "Regarding execution of java code" New topic

Regarding execution of java code

Kaarthik Vaidiswaran

Joined: Nov 07, 2000
Posts: 10
Interpreter is usually slower than a compiler.Then why is apart of java coed being interpreted.I do understand that it is for platform independence.What if the other part of the code is also compiled? Will there be any siginificant effect in performance. Kindly clarify this.
Vummidi Satya

Joined: Aug 06, 2007
Posts: 7
Look Karthikeyan,
I'm not clear with your question. But here I'm trying to explain a little bit about that corner.
If we want to execute a program without interpreting, It should be compiled to an executional format. It is proven that a platform independent exe-Format impossible because of many reasons(like each M/c has it's own data format, cpu registers etc... Exe file depends on all these issues!!). So what java is doing is, Instead of generating exe-format for one specific machine it is generating a code for a special Machine(which is independent of any issues like cpu registers and their lengts etc.. and also every machine can follow this Machine easily by addind some software). Any Java child can guess that Machineis "Virtual Machine" and that code is "BYTE CODE"!
Any machine which wants to execute Java(byte code), first it should have Java Vitrual Machine. Byte code instructions can not send directly to actaul machine, so Java Virtaul Machine first interpret and send that interpreted code(Machine dependent) to actaul machine.
After reading this, still you have doubt specify clearly.

Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Last and first names are required at JavaRanch. Read more here.

"I'm not back." - Bill Harding, Twister
Jack Shirazi
Ranch Hand

Joined: Oct 26, 2000
Posts: 96
I would further add that interpreted code is <em>significantly</em> slower than compiled code, but that Java addresses this having the JVM generate compiled code, thus gaining the best of two particular worlds, i.e. platform independence for Java apps and compiled code for speed.
I agree. Here's the link:
subject: Regarding execution of java code
It's not a secret anymore!