Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Turbo-charging JavaTM HotSpot Virtual Machine  (Read 4081 times)
0 Members and 1 Guest are viewing this topic.
Offline shawnkendall

Senior Member





« Posted 2002-11-14 11:20:37 »

New article on tuning HotSpot from java.sun.com

http://developer.java.sun.com/developer/technicalArticles/Programming/turbo/

Shawn Kendall
Cosmic Interactive, LLC
http://www.facebook.com/BermudaDash
Offline leknor

Junior Member




ROCK!!!


« Reply #1 - Posted 2002-11-14 13:07:11 »

thanks for the link, until I can read it all I thought I'd mention how I turbo-charge my JVM. I use the -XX:+PedalFaster and/or -XX:+SquirrelGC .  Grin Ok, back to work.
Offline pepe

Junior Member




Nothing unreal exists


« Reply #2 - Posted 2002-11-14 13:19:18 »

lol.

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline GergisKhan

Junior Member




"C8 H10 N4 O2"


« Reply #3 - Posted 2002-11-14 20:38:55 »

If I read that article correctly, no matter what happens there is ALWAYS a stop-the-world phase during garbage collection.... and it ALWAYS seems to take a huge amount of time.

If this is true,  Shocked

For the gaming community what can we do to minimize this impact?  Any thoughts?  And no, I don't mean simply just using -Xincgc, I figure that's the first thing we try.... I mean more aggressive techniques.

gK

"Go.  Teach them not to mess with us."
          -- Cao Cao, Dynasty Warriors 3
Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #4 - Posted 2002-11-14 21:21:31 »

Quote

For the gaming community what can we do to minimize this impact?  Any thoughts?


Yes, we can. We have to write games that are appropriate for Java. And maybe these are not maximum-framerate games running in a tight loop.

Make your gameloop do whats needed - and then go to sleep().  Give the JVM some time to breath.

Thats also the way Java3D is meant to operate.

To my experience a Java program will never run smoothly if you overcommit the primary gamethread. Even Java3D apps can run smoothly if not WakeupOnElapsedFrames(0) but WakeupOnElapsedTime( aGoodValue ) is used to drive the game.

In my prototype, I have an FPS slider. If you put it to 30, everything is smooth, if you goto 80, you experience teh stop-the-world phase!


HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2002-11-15 09:49:02 »

Or alternatively just sit back while swapBuffers puts your thread to sleep for you in GL Smiley

And don't be allocating any objects in your rendering loop.

Create them all at game init and level init, and recycle them. It's nearly guaranteed to get rid of the pauses but at the expense of a little complexity. But the C/C++ crowd have been doing this for years because malloc and new are so inefficient.

Cas Smiley

Offline Herkules

Senior Member




Friendly fire isn't friendly!


« Reply #6 - Posted 2002-11-15 11:24:40 »

.... ending up with good-old C programs written in Java - only slower....

Java w/o new is real hard stuff. And I'm afraid that even if you do it yourself, other libs and threads will do it for you.

Java3D? Collections? IO? Events? AWT?

I wouldn't advocate programming without new, but one should be very keen on avoiding it whereever possible!



HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline GKW

Senior Member




Revenge is mine!


« Reply #7 - Posted 2002-11-15 16:17:01 »

I run an old dual p2/333 at home and I must say the new concurrent collector does wonders.  I have been able to almost totally eliminate any gc pauses.  Every once in a while you notice a slight hitch when it does a full pass but other than that it is very smooth.  I have read in a couple places that 1.4.2 and 1.5 will give us many more gc options so for the next few months I am going to be very optimistic.
Offline cknoll

Junior Member




Flame On!


« Reply #8 - Posted 2002-11-15 17:08:31 »

In my (extremely limited) experienced writing some timing-critical drawing routines, I've found that the best way i've managed to eliminate garbage collection is to create state-objects that are created once and maintain the state of things for various operations, and also have 'init' methods on them when I need to reset them for another action...I donno if that makes sense, but basically the point is that instead of re-creating objects (that will be needing to be garbage collected later) I define objects that I can modify values of and reuse the memory instead of creating whole new objects again (I do this sort of thing with my line interator class (search the old forums) and it allowd me to traverse a series of points with no object creation.

With the single-threaded nature of most games, you won't need to worry about your state object being mucked with when you aren't looking (if you write in a single-threaded archietecture).

I think the number one rule in high performance game programming is zero garbage collection (if possible).  Even if that means resorting to pooled objects that are placed in a pool and used and then put back into a pool (but the pool objects never go away) you don't tax the garbage collector...I wonder if the garbage collector is smart enough to realize that if there's no object creation since it's last sweep, it has no work to do.

-Chris
Offline princec

JGO Kernel


Medals: 282
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2002-11-16 09:28:34 »

I believe that using the standard collector options you will see absolutely no garbage collection at all if you don't call new.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline darcone

Junior Member




Size matters


« Reply #10 - Posted 2003-04-01 11:14:34 »

Hooray for System.gc() Smiley
Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #11 - Posted 2003-04-01 14:03:37 »

Well I have been experimenting with adaptive heuristics in 3d scene rendering and to tell the truth the sight isn't pretty.

Getting an adaptive oct/quadtree to run in a tight loop is almost impossible, since there is no way to flag objects to be deleted in the next cycle.

One thing i'd like to see in the garbage collector is user-ability to flag objects to be deleted in next garbage collection run, for example

Node child[4] = new Node();

do node stuff, nodes 3 and 4 were required in the last loop, but now they are obsolete since the scale changed.

System.flagToDelete(node[3]);
System.flagToDelete(node[4]);
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #12 - Posted 2003-04-01 14:20:11 »

node[3] = null;
node[4] = null;

Smiley

Actually I assume you mean to give objects directly to the collector so it doesn't have to find them itself... the thing with that is that the collector must still verify that there are no references to the objects any more..  so it has to do all that 'finding' work anyway to prevent potential access to collected objects.

In other words... Your idea won't work Sad

Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #13 - Posted 2003-04-01 14:24:37 »

Quote

Getting an adaptive oct/quadtree to run in a tight loop is almost impossible, since there is no way to flag objects to be deleted in the next cycle.


Maybe this is a case where Object pooling would work?

Don't flag objects for deletion.. put them back in the pool to be recycled.

Depending on various factors, object pooling can pay off.  But in general it is discouraged as it makes more long-lived objects for the collector.  If you can keep all of your per-frame objects in the 'short-lived' ('nursery') part of the Java heap then maybe you can get away with a few 'new's per frame.

Offline Captain-Goatse

Junior Member




I suck at teh 2D. XBOX IS BIG LOL!111


« Reply #14 - Posted 2003-04-02 07:27:56 »

As palmer said it won't work, however I don't know enough about the GC to discuss about this matter

I'm currently running with pooling. It is not the most elegant way to do it, but more a cheap alternative that eventually costs more than the more expensive route. However, pooling *is* more more expensive than doing non adaptive map, where the initial point of adaptivity gets trashed. So basically a static quadtree is just better.

Adaptive lod on the otherhand is not a problem the way I see it. As long as i'n using simple types, such as floats, there won't be a big hit in performance, since if I have 600 nodes with 7 sub divisions that will be only few hundred new objects and actually I'm not even newing the object, just changing the content.


Offline Jeff

JGO Coder




Got any cats?


« Reply #15 - Posted 2003-04-21 19:51:42 »

Im a bit confused as to the goal here.  

AFAIK you shouldnt reallty care when thinsga re colelcted so long as you always have cheap memory available for you current
operations.

if you are keeping objects referenced for only 1 frame at a time then again FWIK it should never escape the newsapce, where allocation and collkection are very cheap.  (Arguably as cheap or cheaper then the work invovled in managing a pool.)

It is possible yo uare creating so many object thats you are thrashing the new space and causing object to prematurely progress to the next generatioon.  There is an -XX falg for adjusting the size of the new space (and given time, HS will make adjustments  on its own.)


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
kul_th_las
Guest
« Reply #16 - Posted 2003-05-06 22:13:10 »

Another article, all about the garbage collectors available as of 1.4.2, and how to tune them to your bidding (at least as much as we can). Detailed examples of when to, and when not to use particular collectors, and good tips on how to optimize each collector for a specific task. The moral here? Work with the collector and don't assume right away that it is your enemy (though it may turn out to be so anyway).

This surely duplicates some information found in the article that started this whole thread.

NOTE: At the bottom of the article is a link to a useful FAQ.
http://java.sun.com/docs/hotspot/gc1.4.2/index.html
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (12 views)
2014-04-15 18:08:23

BurntPizza (11 views)
2014-04-15 03:46:01

UprightPath (24 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (108 views)
2014-04-08 23:06:04

tom_mai78101 (208 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!