• RSS
  • Facebook
  • Twitter

Knowledge is Power.

  • Who you are ?

    Working on machines without understanding them ? Then you should be here..

  • Where you are ?

    Geographical location should not become a barrier to Share our knowledge.

  • What do you do ?

    Puzzles and Interview question are intended to be discussed here.

    Saturday, February 20, 2010

    Actually Java as well as C# uses Just-In-Time compilation, which is kind of mix of the two. A java compiler is initially converted in a intermediate bytecode that runs in the JVM. The whole discussion on compliler x interpreter is a long debate....

    Speed:
    Up to a few years ago, the speed difference was considerable, a interpreter would run maybe 10-100x slower than the same code if it was compiled. But new technologies makes the speed difference not so relevant except for the most time critical code (the difference today is more like 2X slower for bytecode, and in some benchmarks it is equivalent to the same code in compiled languages like C and C++). Two of the main technologies that made this possible is the pre-compilation to native code of critical parts of the code and also the capacity to adapt the program to the hardware individually: In compiled code the code is put in stone when it is compiled, so if the computer it is running has a more advanced configuration that the one used in the compilation it is not capable of fully use these new features. In Just-in-time code the VM can compile the program to use the full range of resources available.

    Portability :This is where JIT code gains a advantage over compiled code. Lets say you make a program and compile it on a Linux x86 PC, if you want to take this program to a SPARC, ARM, Mainframe or even a Windows or OSX x86 machine, you would at least need to recompile this program (in most cases it is a lot more work than just recompile, because most OS´s are incompatible except for the most basic functions). If you have a new version of the OS, processor, etc... you probably would need to recompile the code.

    This recompilation process can be a real headache when you have thousands of programs running in a lot of different OS and hardware, so a lot of big companies are using Java and other technologies to "future proof" their code. The main question of finding the best combination of speed and portability for each kind of Application.

    0 comments:

    Post a Comment