GCJ slower than JDK?

Per Bothner per@bothner.com
Mon Jan 28 15:58:00 GMT 2002


Fernando Lozano wrote:
> I wrote a small test program which tries to find wether a list of files 
> contains two or more files with the same contents. It first groups all 
> files with the same size, then it gets a checksum for all files with the 
> same size and if the checksum matches they are grouped as real duplicates.

In other words a very file-intensive benchmark, which tells us nothing
about gcj vs jdk speed.

> Is this to be expected? I guessed the gcj binaries would be much faster 
> than the Java class files.

It varies quite a bit.  For some things gcj is much faster, for some we
are noticeably slower.  Reasons might include:
* Some optimization we fail to do.  Note we have relatively little
resources put into Java-specific optimizations compared to Sun.
* Some optimizations that a good JIT can do because it can do
adaptive optimizations, for example.
* Possibly better tuned run-time libraries or primitives or gc.  (In
some places we might be faster because of libraries without that
necessarily saying anything specific about gcj vs jdk.)

Note exction speed is not the only reason yu might prefer gcj (besides
it being Free):
* Reduced start-up time (compared to JIT-compiling everything).
* Reduced memory needs.

> Using gcj 2.96 and IBM Java SDK 1.3.0 under Red Hat Linux 7.1

gcj 2.96 is pretty old.  Try 3.x or the current cvs tree or
recent pre-3.1 snapshots.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/



More information about the Java mailing list