• Post Reply Bookmark Topic Watch Topic
  • New Topic

Informatiom about JIT  RSS feed

 
Abhijit Das
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like to know how JIT is working . Is JIT needed to installed seperately to work on. How it is differed from JVM.


Thanks
Abhijit
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sun's JVM contains a JIT (Just-In-Time) compiler. You do not need to install it separately; the JIT is part of the JVM.

The JIT compiler translates the Java bytecode in your Java program to native machine code for the processor that the JVM is running on. It does this while the program is running (that's why it's called "just-in-time"). When the program is converted to native machine code, it can run very fast.
 
Doug Slattery
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

This thread is perfect for an opinionated point of view of mine, a bit OT (off topic) from the exam...

My former employer has been developing web sites for some time now. At the beginning (of web development), they hired a few web developers that had experience in Java. After deploying some sites, there were complaints that they were slow. Eventually, they were rewritten in 'C'. Several years later, they are back in the same boat. Recently, a couple other rather large sites were deployed in Java and they are experiencing the same "slow" complaints. The proposed solution was to add faster servers. To me, that's kind of stupid because the systems are scalable and that solution is only short term as the root problem will scale exponentially.

I'm not knocking JIT, as it has a well suited place such as a daemon or service where it will be running for long periods of time and the JIT overhead will be minimal.

But to use Java as a cgi on a high traffic web server?.?. That doesn't sit right with me. IMHO, a lower level language such as 'C' is better suited for web servers, and even the JNI mentions that one of its purposes is where performance counts and Java falls short in that area.

I also wonder why they decided to use JIT, and not create a standalone executable?.?. Couldn't the JVM check for it at runtime and compile one if it doesn't exist?

I'm looking forward to hearing the responses of the gurus .

Aloha,
Doug
 
Bob Ruth
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a pipe-dream, but I think it would be neat if the JVM had an option to precompile an entire program and deposit it in a native executable file for the platform that you could then run as native code first rattle out of the box. Just another option...
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But to use Java as a cgi on a high traffic web server?.?. That doesn't sit right with me. IMHO, a lower level language such as 'C' is better suited for web servers, and even the JNI mentions that one of its purposes is where performance counts and Java falls short in that area.


But who the heck would use Java as part of a CGI script? WTF?

Java on a web server is generally done as a servlet, or as a JSP which compiles to a servlet. Servlets should be executed once. They stay resident to handle multiple calls. And they can even handle multiple calls in parallel on different threads.

Henry
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bob Ruth:
Just a pipe-dream, but I think it would be neat if the JVM had an option to precompile an entire program and deposit it in a native executable file for the platform that you could then run as native code first rattle out of the box. Just another option...


They already exist -- just google for "java aot". AOT, aka Ahead of time, aka native compilers will compile directly to the native plaform. I believe GNU even has one.

In any case, they don't work for all cases, as there are some java stuff that just can't be compiled ahead of time -- particularly programs that use there own class loaders that modify bytecode.

Henry
 
Mike Anna
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My two cents on the original question.
Some time ago I remember reading somewhere that if your compiler aint giving you line numbers where exceptions have occured, then you gotta turn on the JIT using some command line option ( ud have to google for it).

Rgds
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mike Anna:
if your compiler aint giving you line numbers where exceptions have occured, then you gotta turn on the JIT using some command line option


It's also possible that the debugging information has been stripped from the class file through the javac "-g:none" option.

It's possible to turn off the JIT by starting the JVM with"java -Xint".
 
Abhijit Das
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanking to All for the valuable infomation
 
Bert Bates
author
Sheriff
Posts: 8954
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you guys are lucky I didn't catch this earlier and move it to the intermediate forum!

Also, I think discussions of performance are very valid, but that discussion should be started in a new thread.

Thanks,

Bert
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!