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
Joined: Aug 06, 2007
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.
Joined: Jan 30, 2000
Last and first names are required at JavaRanch. Read more here.
"I'm not back." - Bill Harding, Twister
Joined: Oct 26, 2000
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.