From owner-freebsd-java@FreeBSD.ORG Wed Nov 15 05:22:46 2006 Return-Path: X-Original-To: freebsd-java@freebsd.org Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3229A16A403 for ; Wed, 15 Nov 2006 05:22:46 +0000 (UTC) (envelope-from mv@thebeastie.org) Received: from p4.roq.com (ns1.ecoms.com [207.44.130.137]) by mx1.FreeBSD.org (Postfix) with ESMTP id C049843D55 for ; Wed, 15 Nov 2006 05:22:45 +0000 (GMT) (envelope-from mv@thebeastie.org) Received: from p4.roq.com (localhost.roq.com [127.0.0.1]) by p4.roq.com (Postfix) with ESMTP id 0E0824CFF2 for ; Wed, 15 Nov 2006 05:22:51 +0000 (GMT) Received: from smitch7.jumbuck.com (unknown [206.112.99.82]) by p4.roq.com (Postfix) with ESMTP id CE7C44D002 for ; Wed, 15 Nov 2006 05:22:50 +0000 (GMT) Received: from smitch7.jumbuck.com (mail.jumbuck.com [206.112.99.82]) by smitch7.jumbuck.com (Postfix) with ESMTP id 6C1CE411505; Wed, 15 Nov 2006 05:22:44 +0000 (UTC) Received: from [192.168.46.102] (ppp166-27.static.internode.on.net [150.101.166.27]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smitch7.jumbuck.com (Postfix) with ESMTP id B2CA6411046; Wed, 15 Nov 2006 05:22:43 +0000 (UTC) Message-ID: <455AA421.9070305@thebeastie.org> Date: Wed, 15 Nov 2006 16:22:41 +1100 From: Michael Vince User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.7.13) Gecko/20060727 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Nikos Ntarmos References: <20061110221501.GC72658@ace.b020.ceid.upatras.gr> <20061111035758.GA88440@ace.b020.ceid.upatras.gr> <20061112.214630.485563740.shudo@utagoe.com> <20061113001106.GA74300@ace.b020.ceid.upatras.gr> In-Reply-To: <20061113001106.GA74300@ace.b020.ceid.upatras.gr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Cc: freebsd-java@freebsd.org Subject: Re: Performance of Java on FBSD vs. others... X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Nov 2006 05:22:46 -0000 Nikos Ntarmos wrote: >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)... > > > 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. Regards, Mike