Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
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  
  java.lang.Compiler  (Read 3169 times)
0 Members and 1 Guest are viewing this topic.
Offline paradox

Senior Newbie




Java games really, really, really rock!


« Posted 2002-11-28 06:08:04 »

While browsing the API, I noticed the class java.lang.Compiler.  I was wondering if it was possible to use it to try and prod the hotspot compiler into compileing your classes before you start up the main game loop?

I've been working on my game both windows and linux, and it seems to me, that under linux my game takes a long time untill it is running at full speed, where as under windows after about 5 seconds of play, it stabilizes at 25 frames per second.  I'm not sure, but it would seem that the hotspot compiler is taking a lot longer to figure out what it wants to optimize, and compile it under linux.  

Could I somehow use java.lang.Compiler to reduce the amount of time it take my game to get to full speed under linux?  What exactly is Compiler there for, and should I be using it?

Thanks in advance
- Luke
Offline pepe

Junior Member




Nothing unreal exists


« Reply #1 - Posted 2002-11-28 07:04:56 »

would be fun if it could help to compile routines we know we'll use intensively, without having to wait fot hotspot to find it by itself.
Will test that. sounds cool.

Home page: http://frederic.barachant.com
------------------------------------------------------
GoSub: java2D gamechmark http://frederic.barachant.com/GoSub/GoSub.jnlp
Offline pepe

Junior Member




Nothing unreal exists


« Reply #2 - Posted 2002-11-28 08:37:26 »

First test report.
well, i don't know if compilation is really done. it takes very few time, and the results of the bench does not change.
If compilation is done, no optimisation is done (or at least the inlining, that's certain), thus, lots of the benefit for me disappears.
Will test more when i'll have more time.

What do the tests on your side give?

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 paradox

Senior Newbie




Java games really, really, really rock!


« Reply #3 - Posted 2002-12-03 02:54:35 »

Hi

I had a bit of a play around with it, however I couldnt really get it working.  Compileing most of my classes returned a false, which ment that they couldnt be compiled.  Perhaps you need to instiantiate your classes before you can have them compiled.  I was hoping though that somebody would be able to tell me why compiler was included in the API and what it is for.

- Luke
Offline rsk

Senior Newbie




I love YaBB 1G - SP1!


« Reply #4 - Posted 2002-12-09 12:39:43 »

If you want your code compiled to native code, change this setting:

-XX:CompileThreshold=10000 number of method invocations/branches before (re-)compiling [10,000 -server, 1,500 -client]


Set it to like "10", so if the method is accessed 10 times, its compiled to native code... or 1 or something like that. I've tried this wtih Netbeans (beast-app) and the startup time is pretty aweful, but the app runs really snappy after that. The memory consumption goes up though....
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #5 - Posted 2002-12-10 01:04:20 »

(not to disagree with that last post, but) a warning: some people may not have that option on their Java VM. -X is a prefix for "unofficial, unsupported switch".

From the java API docs, java.lang.Compiler is really just a convenient way of interacting with whichever Compiler your VM is currently using (there are command-line switches to chose different Compiler's to be used by your VM, if you have them).

It mostly isn't defined by Sun (e.g. the javadoc comment for one method is "...and perform some documented operation" without even suggesting possible operations that this might include. I.e. Sun provides this as a sort of "reflection on your VM/compiler" letting you send custom commands to the compiler.

Its almost entirely useless unless you have the documentation for your compiler.

Since Java 1.4 no longer has a JIT compiler (in the traditional sense, don't have a URL for this, but look at release notes for Jav 1.3, 1.4), you may find that the Sun JDK's NEVER have a valid java.lang.Compiler any more. (the methods are pretty much "old style" java i.e. they aren't well named, they aren't properly documented, which is generally a sign that Sun have lost interest and probably don't care about that class much any more)

malloc will be first against the wall when the revolution comes...
Offline paradox

Senior Newbie




Java games really, really, really rock!


« Reply #6 - Posted 2002-12-10 01:16:06 »

Hmmm, the CompileThreshold method gives me a bost of about 6 or 7 FPS under linux.  Unfortunately I am kinda disapointed with the speed under linux.  Acording to the profiler my game spends 63.3% of its time inside something called sun.awt.X11PMBlitLoops.Blit, where as under windows the big bottleneck was in a few methods of mine that need optimising.  does anybody know if any speedups are planed for linux graphics?  I herd a rumour, that they were going to change eveything to run using openGL so, full screen mode, and graphics accleration should run properly under linux.

- Luke
Offline paradox

Senior Newbie




Java games really, really, really rock!


« Reply #7 - Posted 2002-12-10 01:17:39 »

Hmmm, the CompileThreshold method gives me a bost of about 6 or 7 FPS under linux.  Unfortunately I am kinda disapointed with the speed under linux.  Acording to the profiler my game spends 63.3% of its time inside something called sun.awt.X11PMBlitLoops.Blit, where as under windows the big bottleneck was in a few methods of mine that need optimising.  does anybody know if any speedups are planed for linux graphics?  I herd a rumour, that they were going to change eveything to run using openGL so, full screen mode, and graphics accleration should run properly under linux.

- Luke
Offline paradox

Senior Newbie




Java games really, really, really rock!


« Reply #8 - Posted 2002-12-10 01:19:29 »

Hmmm, the CompileThreshold method gives me a bost of about 6 or 7 FPS under linux.  Unfortunately I am kinda disapointed with the speed under linux.  Acording to the profiler my game spends 63.3% of its time inside something called sun.awt.X11PMBlitLoops.Blit, where as under windows the big bottleneck was in a few methods of mine that need optimising.  does anybody know if any speedups are planed for linux graphics?  I herd a rumour, that they were going to change eveything to run using openGL so, full screen mode, and graphics accleration should run properly under linux.

- Luke
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 (31 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

CJLetsGame (198 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

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
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!