From: <ka...@us...> - 2012-03-01 22:34:40
|
Revision: 3747 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3747&view=rev Author: kappa1 Date: 2012-03-01 22:34:34 +0000 (Thu, 01 Mar 2012) Log Message: ----------- Tweak Display.sync() method a little to reduce the Thread.yield() time even further, now with a minimum of 0 yield time. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-02-29 23:18:35 UTC (rev 3746) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/Display.java 2012-03-01 22:34:34 UTC (rev 3747) @@ -86,7 +86,7 @@ private static boolean syncInitiated; /** adaptive time to yield instead of sleeping in sync()*/ - private static long adaptiveYieldTime = 1000*1000; + private static long adaptiveYieldTime; /** X coordinate of the window */ private static int x = -1; @@ -444,12 +444,12 @@ // auto tune the amount of time to yield if (overSleep > adaptiveYieldTime) { - // increase by 500 microseconds (half a ms) - adaptiveYieldTime = Math.min(adaptiveYieldTime + 500*1000, sleepTime); + // increase by 200 microseconds (1/5 a ms) + adaptiveYieldTime = Math.min(adaptiveYieldTime + 200*1000, sleepTime); } - else if (overSleep < adaptiveYieldTime - 1000*1000) { + else if (overSleep < adaptiveYieldTime - 200*1000) { // decrease by 5 microseconds - adaptiveYieldTime = Math.max(adaptiveYieldTime - 5*1000, 1000*1000); + adaptiveYieldTime = Math.max(adaptiveYieldTime - 2*1000, 0); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |