Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

what is the function of JIT ?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hallo,
JIT is the just in time compiler. But it was not in
java 1.1 version. Now in java 2.0 version , it is there.
What it makes change ? What is the main function ?
How it beneficial to Java program ?
with regrards,
prashant dave
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know that much about it, so somebody correct me if I'm wrong, but I think it's like this:
The Just-In-Time compiler is part of the VM. Basically, as the program is run, the JIT compiles the bytecode into native machine code (like you would get from compiling C++ code). It does this just before execution of the code, hence 'just in time'.
It take a bit of time to compile the bytecode to native code, but native code runs much faster. I read (I forget where) that in some cases, JIT compilation can speed up code by as mush as 10x, but sometimes it can make it slower, due to having to compile it.
Hope that helps.
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Grant is right!
I had an algorithm heavy Java program. I happened to be ordered to write exact the same thing in VC++. (Don't want to tell why. Go figure! ). The more complicated the algorithm, the more nested iterations needed, the faster the Java program since the effect of JIT.
At the beginning, my VC++ program runs a little more than twice faster than my Java program. At the end with the most complicated case, believe me or not, my Java program runs nearly twice faster than my VC++ program!!!
Roseanne
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats good news that in some cases Java Program can run faster then VC++, although, since the compiled VC++ code is also native machine code, without the overhead of JVM,(meaning it is actually running on the Real Machine) so I find it difficult to understand that in which condition will a VC++ code run slower then Java code.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was puzzled by my results too for a while, until I talked with several real Java gurus. Their explanation was the optimization in JIT compiler were getting better and better when iteration increases. I don't know the details.
Just FYI, the VC++/Java time ratio of the relative "simple" (very complicated graph theory stuff) code was about 610ms/1320ms. The ratio of the "most complicated" one was about 26000ms/14000ms. No GUI involved, but some i/o with text files included, timing started after GUI hits OK on the same machine and used the same algorithm.
Roseanne
[This message has been edited by Roseanne Zhang (edited November 26, 2000).]
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just remember something in history, therefore, I want to add some here.
Not all the binary code (native code/machine code) is created equal. The same C++ generated native code can run huge speed difference.
If I remember it correctly, the historical example was the speed difference between Borland C++ v3.1 and Microsoft VC++ v1.0, with the same C/C++ code (literally), compiled by the two compilers, Borland exe was generally 10 times faster than M$VC then, documented by PC Magazine(~1992/1993?). However, if you wrote just <10 lines of code, the speed difference could goes even larger. Of course, later, M$VC won for a lot of complicated reasons .
I saw Paul Wheaton has some comments about the speed of C++ and Java somewhere. The speed of C++ goes as fast as it can be now, but Java just started. Not exactly his original words. I agree with him on this.
Java wins!
Roseanne

[This message has been edited by Roseanne Zhang (edited November 26, 2000).]
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to add something here. A JIT is run *only upon class load* and *only once*. Therefore, a JIT's optimizations are static and may or may not provide any improvement depending on the application. There are over 15 years worth of algortihmic optimization theory tied into JIT, so, in general, you should see an improvement.
JIT's run into problems when they, for example, inline what may not be a quick running function. In other words, you can't control the optimizations very well (the command line arguments are undocumented and "arcane") and you can be penalized for bad coding. Sun has created a dynamic bytecode optimizer called HotSpot which dynamically adjusts its optimizations depending on the running conditions at the time. It keeps track of memory allocation and algorithms to provide an application with better overall performance (read "over long periods of time"). This is really good of Java based application servers which can run for months.
Finally, please note that neither of these have anything to do with the non-existent optimizations incorporated with the -O option in javac. Sun's priority is optimizing the bytecode during run-time, not during compile time. If you consider the goal of Java, you will see why Sun has made this decision.
Jesse
 
Jesse Tilly
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
btw, JITs have been around since JDK 1.1, just not as part of the JDK.

Jesse
 
Ranch Hand
Posts: 103
Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! All,
Want more information about JIT please see this link
Anil
 
Jesse Tilly
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please note that the article refers to a design and implementation found only in IBM's JDK 1.1.x JVMs. While they are widely considered the fastest JVMs on the planet, they are still not Java2 compliant.
Jesse
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem.
An IRC Client applet is running without problem on win98 or win95, but win2k and winME users have problems when the JIT Compiler is enabled in their browsers. No error in java console when JIT is enabled, but the irc server drops their connections with connection reset by peer.
so what can be the problem? Or can I disable the JIT compiler for my applet?
email answer is also good: csiszi@chat.trefort.net
thx
[more]
Win ME users said: "JIT.DLL caused illegal op in kernel32"
Can I disable JIT from the applet (only for my applet, not the whole JIT)?? Plz...
IEXPLORE caused an invalid page fault in module JIT.DLL at 017f:7c411249.
this is with win98se IE5.5
with disabled JIT, the applet has no problems.
[This message has been edited by Thomas Krasser (edited February 03, 2001).]
[This message has been edited by Thomas Krasser (edited February 03, 2001).]
    Bookmark Topic Watch Topic
  • New Topic