Or more portable?bhlangonijr wrote:The HotSpot VM does that. IMO it is more like a "feature" present in most VM's to improve performance. Although it doesn't make the JVM a "compiler" itself.rbarreira wrote:I believe that most important JVM's compile the compiled bytecode into actual machine code for the architecture being used.bhlangonijr wrote:Where did you get that the JVM is a compiler? The JVM is the Java Virtual Machine and is responsible for running the Java bytecode (the compiled artifact). The compiler is present in the JDK which is not required for executing the Java binaries.rbarreira wrote:The JVM is a compiler, it could even be written in BASIC and the compiled Java code might be faster than anything.bhlangonijr wrote:The JVM itself is written in C++ how could it be faster?
Of course, we all know that in general Java is definitely not faster than C or C++.
Regards,
Some JVMs may not do this, but the ones for the most popular architectures / OSs certainly do. If bytecode emulation was always used, Java programs would run MUCH slower on those computationally intensive benchmarks instead of two times slower and similar.
The point I was trying to make is that there is a middleman between the Java code and the machine code and it was actually written in the language C++. So how could we expect Java to be faster than C++?
Does Crafty or Stockfish or Komodo, going to Java?
Moderator: Ras
-
Bo Persson
- Posts: 264
- Joined: Sat Mar 11, 2006 8:31 am
- Location: Malmö, Sweden
- Full name: Bo Persson
Re: Does Crafty or Stockfish or Komodo, going to Java?
-
Mangar
- Posts: 65
- Joined: Thu Jul 08, 2010 9:16 am
Re: Does Crafty or Stockfish or Komodo, going to Java?
Hi,
some time ago Spike had a source code that could be compiled by a Java compiler and a C++ compiler. We had a little search & replace program for some code pieces as not all could be handled by macros.
Java took about 1.6 the time as C++, using a just in time compiler used for server applications.
The factor 1.6 is mainly coming from array access range checks. Spike use a lot of array access. Java tests if the index is inside the range (two tests) before reading from the array. IMHO the main difference in speed is there.
There is no reason to use Java instead of C++.
Greetings Volker
some time ago Spike had a source code that could be compiled by a Java compiler and a C++ compiler. We had a little search & replace program for some code pieces as not all could be handled by macros.
Java took about 1.6 the time as C++, using a just in time compiler used for server applications.
The factor 1.6 is mainly coming from array access range checks. Spike use a lot of array access. Java tests if the index is inside the range (two tests) before reading from the array. IMHO the main difference in speed is there.
There is no reason to use Java instead of C++.
Greetings Volker
Mangar Spike Chess