• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding execution of java code

 
Kaarthik Vaidiswaran
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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.
Thanx
karthik
 
Vummidi Satya
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

------------------
-SaTyA-
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Last and first names are required at JavaRanch. Read more here.
 
Jack Shirazi
Author
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic