Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (482)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (548)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Game Development / Performance Tuning / Re: Escape Analysis? on: 2009-02-12 07:29:18

Now Java SE 6 has escape analysis !

Java 6u11  -server -XX:+AggressiveOpts:

    Testing 1.0E7 allocation of an Object   : 208 ms.
    Testing 1.0E7 Local objects allocation (method scope) : 313 ms.
    Testing 1.0E7 allocation of object in a loop  : 433 ms.


Java 6u14  -server -XX:+AggressiveOpts:

    Testing 1.0E7 allocation of an Object   : 61 ms.
    Testing 1.0E7 Local objects allocation (method scope) : 94 ms.
    Testing 1.0E7 allocation of object in a loop  : 79 ms.


You can download it from http://download.java.net/jdk6/binaries.

Regards
                   Angelo

2  Game Development / Performance Tuning / Programming to the cache on: 2008-06-27 07:01:29

There are already available some improvements to hotspot (6up6) that work on 64bits OS.

http://java.sun.com/javase/technologies/performance.jsp]]http://java.sun.com/javase/technologies/performance.jsp

According to Sun site:

"These performance enhancements will be included in an upcoming standard release of the Java SE platform."

These improvements will probably include (http://www.ssw.uni-linz.ac.at/Research/Papers/Ko08/):

Scalar replacement: If an object does not escape the creating method, its
fields can be replaced by scalar variables.

Stack allocation: An object that is accessed only by one method and its callees
can be allocated on the stack instead of the heap.

Automatic Object Colocation and Inlining: Two objects, where one containing (by reference)
the other, will be stored in memory as one object.
It reduces the access costs of fields and arrays by improving
the cache behavior and by eliminating unnecessary field loads.

The same applies to objects containing an array of size known at creation time (String object included)
http://www.ssw.uni-linz.ac.at/Research/Papers/Wimmer08/
http://www.ssw.uni-linz.ac.at/Research/Papers/Haeubl08Master/

Regards

Angelo


3  Game Development / Performance Tuning / Re: how to detect occasional stuttering on: 2008-01-17 08:42:36
Riven,

Micro-benchmarking is like quantum phisycs:
observation is disturbed by measurement itself.

Hotspot compiler is known for having strange behaviour in
some cases.

I have slightly modified your code to make it more readable:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
      // New
     {
         long ts, te;
         ts = System.nanoTime();
         for (int k = 0; k < loops; k++)
            calcNew(a, b, c);
         te = System.nanoTime();
         tNew[i] = te - ts;
      }

      // Pool
     {
         long ts, te;
         ts = System.nanoTime();
         for (int k = 0; k < loops; k++)
            calcPool(a, b, c);
         te = System.nanoTime();
         tPool[i] = te - ts;
      }



Results:

   Java HotSpot(TM) Server VM (build 11.0-b09, mixed mode)

   Typical tNew:  64800135
   Typical tPool: 3851607

So I changed execution order inside Bench.main loop as follows :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
      // Pool
     {
         long ts, te;
         ts = System.nanoTime();
         for (int k = 0; k < loops; k++)
            calcPool(a, b, c);
         te = System.nanoTime();
         tPool[i] = te - ts;
      }

      // New
     {
         long ts, te;
         ts = System.nanoTime();
         for (int k = 0; k < loops; k++)
            calcNew(a, b, c);
         te = System.nanoTime();
         tNew[i] = te - ts;
      }


and I've got

   Java HotSpot(TM) Server VM (build 11.0-b09, mixed mode)

   Typical tNew:  4922693
   Typical tPool: 64387792

It seems that hotspot compiler doesn't optimize first part of for loop.

Angelo
4  Game Development / Performance Tuning / Re: Will be escape analysis based optimizations integrated into Mustang? on: 2005-09-29 15:34:03
 posted this topic into IBM developerWorks  >  Java technology  >  Forums  >  Java theory and practice forum

"I have read last column of Java theory and practice: "Urban performance legends, revisited".
I have been playing with all recent builds of mustang (java 6), but there is no evidence that escape analysis is implemented or enabled.

Best Regards
ARM"


And Brian Goetz replies

"What evidence would you expect to find? The operation is invisible to the program. Also, optimizations like this are dynamic and may not kick in until a program runs for a long time.
Also, it is often common that advanced optimizations are not all "turned on" by default for pre-release JVMs."

See http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?message=13757590&cat=10&thread=96130&treeDisplayType=threadmode1&forum=181#13757590
5  Game Development / Performance Tuning / Re: Will be escape analysis based optimizations integrated into Mustang? on: 2005-09-28 06:18:30

Seems that something is boiling under the cover:

 Excerpted from http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6325352

 "call record_for_igvn(phi) only when escape analysis is enabled."


 Excerpted from http://www-128.ibm.com/developerworks/java/library/j-jtp09275.html

"Escape analysis is an optimization that has been talked about for a long time, and it is finally here -- the current builds of Mustang (Java SE 6) can do escape analysis and convert heap allocation to stack allocation (or no allocation) where appropriate. The use of escape analysis to eliminate some allocations results in even faster average allocation times, reduced memory footprint, and fewer cache misses. Further, optimizing away some allocations reduces pressure on the garbage collector and allows collection to run less often."

6  Discussions / Miscellaneous Topics / Re: Other vms on: 2005-07-12 06:53:49
IBM Jre 1.4.2 is supplied also with the Development Package for Eclipse.

See http://www-128.ibm.com/developerworks/java/jdk/eclipse/index.html.
     
Ciao
7  Game Development / Performance Tuning / Java math performs better with Jdk1.6 ea-19 on: 2005-01-19 12:23:21
Test code excerpted from
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206844



public class mtest
{
 static int ops0;
 static int ops1;
 static int ops2;

 static double DVAL = 13.d;
 static float  FVAL = 13.f;
 static final int LIMIT = 20000000;

 static volatile long L = 0L;

 static long checkVolatileUse()
 {
   L += 32L;
   return L; // L still live here
 }

 static int checkDoubleOps(double dval)
 {
     //modD
     double d1 = dval % DVAL;
     //ConvD2F
     float  f1 = (float)d1;
     //modF
     float  f2 = f1 % FVAL;
     //ConvF2D
     double d2 = (double)f2;
     //sinD
     d1 = Math.sin(d2);
     d2 = d1 * DVAL;
     double res = d1 + d2 ;
     //cosD
     d1 = Math.cos(d2);
     d2 = d1 / DVAL;
     res += d1;
     res += d2;
     
     //tanD
     d1 = Math.tan(d2);
     d2 = DVAL - d1;
     res += d1;
     res += d2;
     //logD
     d1 = Math.log(d2);
     d2 = d1 + DVAL;
     res += d1;
     res += d2;
     //log10D
     //d1 = Math.log10(d2); log10 doesn't exist in  1.4
     res += d1;
     res += d2;
     //ConvL2D
     long l = (long) res;
     //ConvL2F
     l += (long)f1;
     return (int)l;
 }

 static int checkLong2Double (double d)
 {
     long longbits = Double.doubleToRawLongBits(d);
     double d2 = Double.longBitsToDouble(longbits);
     if (d != d2) {
       throw new InternalError("value mismatch");
     }
     long longbits2 = Double.doubleToRawLongBits(d2);
     if (longbits != longbits2) {
       throw new InternalError("value mismatch");
     }

     float f = (float) d;
     int intbits = Float.floatToRawIntBits(f);
     float f2 = Float.intBitsToFloat(intbits);
     if (f != f2) {
       throw new InternalError("value mismatch");
     }
     int intbits2 = Float.floatToRawIntBits(f2);
     if (intbits != intbits2) {
       throw new InternalError("value mismatch");
     }
     return intbits2;
 }

 static int testVolatileUse(int limit) {
   int i = 0;
   L = 0;
   for (ops0 = 0; ops0 < limit; ops0++) {
     i += (int)checkVolatileUse();
   }
   return i;
 }
 static int testDoubleOps(double d, int limit) {
   int i = 0;
   for (ops1 = 0; ops1 < limit; ops1++) {
     i += checkDoubleOps(d);
   }
   return i;
 }

 static int testLongDoubleConversion(double d, int limit) {
   int i = 0;
   for (ops2 = 0; ops2 < limit; ops2++) {
     i += checkLong2Double(d);
   }
   return i;
 }

 public static void main(String[] args)
 {
   double d = 0.0123456789d;
   int i = testVolatileUse(11000);     // warmup
   i = testVolatileUse(10000);         // warmup
   i = testLongDoubleConversion(d, 11000);      // warmup
   i = testLongDoubleConversion(d, 10000);      // warmup
   i = testDoubleOps(d, 11000);      // warmup
   i = testDoubleOps(d, 10000);      // warmup

   long s = System.currentTimeMillis ();
   i = testVolatileUse(LIMIT);  // run
   long t = System.currentTimeMillis() - s ;
   double seconds = ( t / 1000.0);
     System.out.println(" volatile long: " + (int) (ops0 / seconds) + " loops per second. " + i);

   s = System.currentTimeMillis ();
   i = testLongDoubleConversion(d, LIMIT);  // run
   t = System.currentTimeMillis() - s ;
   seconds = ( t / 1000.0);
     System.out.println("raw 64 bits : " + (int)(ops2 / seconds) + " loops per second. " + i);

   s = System.currentTimeMillis ();
   i = testDoubleOps(d, LIMIT);  // run
   t = System.currentTimeMillis() - s ;
   seconds = ( t / 1000.0);
   System.out.println("math on FPU : " + (int) (ops1 / seconds) + " loops per second. " + i);
 }
}


Results on Pentium 4 2.8 Ghz, 1G RAM:



Java HotSpot(TM) Server VM (build 1.6.0-ea-b19, mixed mode)

volatile long: 60790273 loops per second. 832753664
raw 64 bits : 2147483647 loops per second. -448731136
math on FPU : 2475860 loops per second. 1000000000

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Server VM (build 1.5.0-b64, mixed mode)

   volatile long: 18814675 loops per second. 832753664
   raw 64 bits : 2147483647 loops per second. -448731136
  math on FPU : 550070 loops per second. 1000000000


Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2)
Classic VM (build 1.4.2, J2RE 1.4.2 IBM Windows 32 build cn1420-20040626 (JIT enabled: jitc))

      volatile long: 183486238 loops per second. 832753664
      raw 64 bits : 5688282 loops per second. -448731136
      math on FPU : 1921968 loops per second. 1000000000

           Ciao





8  Game Development / Performance Tuning / Re: Newbie Tuning! on: 2004-07-15 04:07:30
Try JFluid !

You can download it from :

http://research.sun.com/projects/jfluid

It will be included into Netbeans v4.0 within few months, as stated in

http://www.netbeans.org/community/releases/40/profiler.html

9  Game Development / Performance Tuning / Re: Yet another speed comparison,weird server resu on: 2004-06-22 13:41:08
Results of running JMandel on Windows XP

>> pentium II 400 Mhz <<
  512 MB ram

 Java HotSpot(TM) Server VM (build 1.5.0-beta2-b51, mixed mode)

     Runtime ms=57152 7.372954664753639 MegaIters per second  Shocked
     Runtime ms=57152 7.372954664753639 MegaIters per second  Shocked
     Runtime ms=56832 7.414469049127252 MegaIters per second  Shocked

 Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

     Runtime ms=34910 12.070441277570897 MegaIters per second
         Runtime ms=34910 12.070441277570897 MegaIters per second

 J2RE 1.4.1 IBM Windows 32 build cn1411-20040301a (JIT enabled)

     Runtime ms=22893 18.406460708513517 MegaIters per second  Smiley
     Runtime ms=22863 18.430612999168964 MegaIters per second  Smiley

 C++ version of JMandel compiled with g++:

     Runtime ms =22692 18.531 MegaIters per second
     Runtime ms =22753 18.481 MegaIters per second
10  Java Game APIs & Engines / JOGL Development / Re: Using a GLCanvas inside a JPanel on: 2003-10-29 10:15:14

Thanks to your assistance, I've solved the problem.

I had totally miss the hints in the article of Swing Connection.

           Thanks

                  Angelo


11  Java Game APIs & Engines / JOGL Development / Using a GLCanvas inside a JPanel on: 2003-10-29 05:46:36
I have to insert a GLCanvas (heavyweight component) into a  JPanel (lightweight component), inside a JFrame with a JMenu.  As explained in

http://java.sun.com/products/jfc/tsc/articles/mixing:


Quote
Guideline  No. 1

Do not mix lightweight (Swing) and heavyweight (AWT) components within a container where the lightweight component is expected to overlap the heavyweight one.


And in fact, GLCanvas overlaps menu lists.

Is there a workaround?

       Thanks for the help.

             Angelo.
12  Game Development / Performance Tuning / Re: Slow array filling on: 2003-10-09 04:51:53

I tried your code with  IBM Jre 1.4.0 for Windows :

                                 Two loops           One loop
Pentium 4 1.5 Ghz         160 ms                 950 ms


Then I ported ArrayTest  to C++, compiled with MS Visual C++ 6.0 (full optimization) :


                                 Two loops           One loop
Pentium 4 1.5 Ghz         160 ms            1101 ms


Probably, It's due to memory access.

                        Ciao

13  Java Game APIs & Engines / JOGL Development / Re: Optimisation help on: 2003-08-29 04:24:30
Excerpt from java.lang.Math:

/**
    ...
    * A result must be within 1 ulp of the correctly rounded result.  Results
    * must be semi-monotonic.
    *
    * ...
    */

   public static double acos(double a)  {
     return StrictMath.acos(a);
      // default impl. delegates to StrictMath
   }
(J2SE) 1.4 math is slower than the corresponding routines in J2SE 1.3.1.

You can use JNI to speed up math calculations, as described in
http://www.javaworld.com/javatips/jw-javatip141.html
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (8 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!