Date: Wed, 14 Aug 2002 16:03:08 +0800 From: Huang wen hui <hwh@mail.gddsn.org.cn> To: "Bill Huey (Hui)" <billh@gnuppy.monkey.org> Cc: java <java@FreeBSD.ORG> Subject: Re: Hotspot vm is extremely slower than nojit vm on current ? Message-ID: <3D5A0EBC.9060706@mail.gddsn.org.cn> References: <3D59C6A4.5020708@mail.gddsn.org.cn> <20020814030231.GA4285@gnuppy.monkey.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Bill Huey (Hui) : >On Wed, Aug 14, 2002 at 10:55:32AM +0800, Huang wen hui wrote: > > >>hi, >>Mostly hotspot vm is stable and fast, but I got problem with Thread.sleep. >>Look at the following simple program, on current hotspot vm is extreamly >>slow. >> >> >... > > >>^^^^^^ >>%~hwh/jre/bin/java -jar TestTimer.jar ; java -jar TestTimer.jar >>query elapse time: 1354 >>query elapse time: 140221 >>^^^^^^ >> >> > >I could have blown it with the sleep math. Previously I multiplied the >value of nanosleep by a 1000x more than it should be. ;) > >bill > > > > > Do you mean you have fixed this bug? Would you mind send the patch to me ? More info of this bug, if this is no sense, I'll apologize. This bug occured in hotspot compiler[1 2] vm, not core vm. and I simplify the test case: The main thread elapse time is exactly as same as the timer sleep time. %~hwh/jre/bin/java -version java version "1.3.1-p7" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-p7-root-020727-22:30) Java HotSpot(TM) Core VM (build 1.3.1-internal, interpreted mode) %~hwh/jre/bin/java TestTimer sleep time: 2006 %java -version java version "1.3.1-p7" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-p7-root-020727-22:30) Java HotSpot(TM) Client VM (build 1.3.1-internal, mixed mode) %java TestTimer sleep time: 100013 ----------------------------------------------------------------------------------------------------------------------- public class Timer extends Thread{ private static ThreadGroup tGroup = new ThreadGroup("Timer"); // Number of seconds in each timer cycle int m_cycle; private boolean bQuit = false; public Timer(int cycle){ super(tGroup,"TimerThread"); m_cycle = cycle; } public void run(){ this.setName("TimerThread"); // Loop until stopped while (!bQuit) { try { // Sleep for the clock cycle sleep(m_cycle * 1000); } catch (InterruptedException ex) { } } } public void quit() { bQuit = true; } } import java.util.*; /** * Test freebsd Hotspot speed. */ public class TestTimer { Timer timer = new Timer(100); public TestTimer() { timer.start(); } public void destoryTimer() { timer.quit(); } public static void main(String[] args) throws Exception{ TestTimer tt =new TestTimer(); long now = new java.util.Date().getTime(); Thread.sleep(2*1000); System.err.println("sleep time: "+ (new java.util.Date().getTime() - now)); tt.destoryTimer(); } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D5A0EBC.9060706>