Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Nov 2006 02:11:06 +0200
From:      Nikos Ntarmos <ntarmos@ceid.upatras.gr>
To:        freebsd-java@freebsd.org
Subject:   Re: Performance of Java on FBSD vs. others...
Message-ID:  <20061113001106.GA74300@ace.b020.ceid.upatras.gr>
In-Reply-To: <20061112.214630.485563740.shudo@utagoe.com>
References:  <20061110221501.GC72658@ace.b020.ceid.upatras.gr> <Pine.LNX.4.62.0611102345280.3696@decibel.pvv.ntnu.no> <20061111035758.GA88440@ace.b020.ceid.upatras.gr> <20061112.214630.485563740.shudo@utagoe.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi there.

On Sun, Nov 12, 2006 at 09:46:30PM +0900, Kazuyuki Shudo wrote:
> I found your code does polling with 50 msec sleeps between checks in
> src/netcins/p2p/dhs/testing/DHSSingleMetricTest.java:

Yes. I've already changed all those Thread.sleep(...) calls to
Thread.yield() (which, if i got it right from the jdk source code,
translates to a sleep(1) on freebsd). That didn't do any big differnce
though. However, I did see a big difference in execution time by taking
away some BigInteger arithmetic (divAndMod) and replacing it with bitwise
operations (the divider was always a power of 2, so shifting and masking
did the job).

I did some more homework on the jdk as well. First, there _is_ such a
thing as OS-specific parts in HotSpot; that's what the bsd patchset
adds (just look into java/jdk15/work/hotspot/src/os/bsd/vm/). I had a
quick look at it and did some minor tweaks (such as chaning
clock_gettime(CLOCK_REALTIME, ...) invocations to
clock_gettime(CLOCK_REALTIME_FAST, ...) which is much faster on my
hardware (and I guess on others' as well). Thread.sleep() and
Thread.yield() seem to use nanosleep(2), so this could do a difference.

I also tested this thing against a no-WITNESS, no-INVARIANTS,
AUTO_EOI_1, ... kernel, using TSC as the timecounter, and with a libc
compiled with NO_MALLOC_EXTRAS=yes, but the runtime was more-or-less the
same.

My guess is that this is not a system-related or a jvm-tweaking issue,
but something that has to do with either the threading library or the
intrinsics of hotspot on bsd...

Anyway, after a day of profiling and tweaking ad nauseum I got the
runtime from ~4700'' down to ~270'' on freebsd. Only now win32 does it
in ~80-85'' which is still a factor of ~3x-3.5x)...

\n\n



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061113001106.GA74300>