Performance of Java on FBSD vs. others...
mv at thebeastie.org
Wed Nov 15 05:22:46 UTC 2006
Nikos Ntarmos wrote:
>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
>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
>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)...
Thats really interesting I wonder where else such things lay, I assume
these are options for -current atm?
Would be good to have these changes alternative build option in the
ports tree for jdk15.
More information about the freebsd-java